summaryrefslogtreecommitdiffstats
path: root/generic/tkScale.c
diff options
context:
space:
mode:
authorrjohnson <rjohnson>1999-04-19 18:56:40 (GMT)
committerrjohnson <rjohnson>1999-04-19 18:56:40 (GMT)
commit3f100af6bdc13e0abd205827a2e697ef5a213c86 (patch)
treefa2a3b65f9a9a6bdb453137f735782a8808dd234 /generic/tkScale.c
parentcb916de9253cefd5b1dc519afc76fd1b2a2fae51 (diff)
downloadtk-3f100af6bdc13e0abd205827a2e697ef5a213c86.zip
tk-3f100af6bdc13e0abd205827a2e697ef5a213c86.tar.gz
tk-3f100af6bdc13e0abd205827a2e697ef5a213c86.tar.bz2
Improved patch for scale widget.
Diffstat (limited to 'generic/tkScale.c')
-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);
}
}