summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorpatthoyts@users.sourceforge.net <patthoyts>2007-11-17 21:28:05 (GMT)
committerpatthoyts@users.sourceforge.net <patthoyts>2007-11-17 21:28:05 (GMT)
commit82b1d93679a7b53ccb7b9765e95f8b3731945961 (patch)
treeaba921a5e65aceda64cb68ca883d80d542fae88b /generic
parentd275a43f9cda933f4350e590d10f881235f8e716 (diff)
downloadtk-82b1d93679a7b53ccb7b9765e95f8b3731945961.zip
tk-82b1d93679a7b53ccb7b9765e95f8b3731945961.tar.gz
tk-82b1d93679a7b53ccb7b9765e95f8b3731945961.tar.bz2
Only check for -displayof if there are sufficient arguments. This permits checking strings like -d.
Diffstat (limited to 'generic')
-rw-r--r--generic/tkFont.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 64c487b..d80227a 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkFont.c,v 1.40 2007/10/21 14:50:19 das Exp $
+ * RCS: @(#) $Id: tkFont.c,v 1.41 2007/11/17 21:28:05 patthoyts Exp $
*/
#include "tkInt.h"
@@ -718,12 +718,14 @@ Tk_FontObjCmd(
case FONT_MEASURE: {
char *string;
Tk_Font tkfont;
- int length, skip;
+ int length = 0, skip = 0;
Tcl_Obj *resultPtr;
- skip = TkGetDisplayOf(interp, objc - 3, objv + 3, &tkwin);
- if (skip < 0) {
- return TCL_ERROR;
+ if (objc > 4) {
+ skip = TkGetDisplayOf(interp, objc - 3, objv + 3, &tkwin);
+ if (skip < 0) {
+ return TCL_ERROR;
+ }
}
if (objc - skip != 4) {
Tcl_WrongNumArgs(interp, 2, objv, "font ?-displayof window? text");