From e8b0cd1f9ddab45649f9cd5cd2267f05e7df9add Mon Sep 17 00:00:00 2001 From: Jonathan Westhues Date: Sun, 10 Jan 2010 16:44:11 -0800 Subject: [PATCH] Oops, don't allow the user to type a zero or negative scale in the view screen. [git-p4: depot-paths = "//depot/solvespace/": change = 2104] --- view.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/view.cpp b/view.cpp index 76a972d..d01a612 100644 --- a/view.cpp +++ b/view.cpp @@ -62,7 +62,12 @@ bool TextWindow::EditControlDoneForView(char *s) { case EDIT_VIEW_SCALE: { Expr *e = Expr::From(s, true); if(e) { - SS.GW.scale = e->Eval() / SS.MmPerUnit(); + double v = e->Eval() / SS.MmPerUnit(); + if(v > LENGTH_EPS) { + SS.GW.scale = v; + } else { + Error("Scale cannot be zero or negative."); + } } break; }