summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkScale.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/generic/tkScale.c b/generic/tkScale.c
index 2ba4765..0710da9 100644
--- a/generic/tkScale.c
+++ b/generic/tkScale.c
@@ -18,7 +18,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkScale.c,v 1.5 1999/04/17 02:05:23 rjohnson Exp $
+ * RCS: @(#) $Id: tkScale.c,v 1.6 1999/04/19 18:56:40 rjohnson Exp $
*/
#include "tkPort.h"
@@ -620,7 +620,8 @@ ConfigureScale(interp, scalePtr, objc, objv)
/*
* If the scale is tied to the value of a variable, then set
- * the scale's value from the value of the variable, if it exists.
+ * the scale's value from the value of the variable, if it exists
+ * and it holds a valid double value.
*/
if (scalePtr->varNamePtr != NULL) {
@@ -630,8 +631,9 @@ ConfigureScale(interp, scalePtr, objc, objv)
name = Tcl_GetString(scalePtr->varNamePtr);
valuePtr = Tcl_GetVar2Ex(interp, name, NULL, TCL_GLOBAL_ONLY);
- if (valuePtr != NULL) {
- Tcl_GetDoubleFromObj(interp, valuePtr, &value);
+ if ((valuePtr != NULL) &&
+ (Tcl_GetDoubleFromObj(interp, valuePtr, &value))
+ == TCL_OK) {
scalePtr->value = TkRoundToResolution(scalePtr, value);
}
}