summaryrefslogtreecommitdiffstats
path: root/generic/tkFont.c
diff options
context:
space:
mode:
authorpatthoyts <patthoyts@users.sourceforge.net>2007-11-17 21:28:05 (GMT)
committerpatthoyts <patthoyts@users.sourceforge.net>2007-11-17 21:28:05 (GMT)
commit6cb937528ddf86aca32fbae1af99b6b4ab59653d (patch)
treeaba921a5e65aceda64cb68ca883d80d542fae88b /generic/tkFont.c
parent47bb49fb410bdc4333931805c2c3df2192d604c3 (diff)
downloadtk-6cb937528ddf86aca32fbae1af99b6b4ab59653d.zip
tk-6cb937528ddf86aca32fbae1af99b6b4ab59653d.tar.gz
tk-6cb937528ddf86aca32fbae1af99b6b4ab59653d.tar.bz2
Only check for -displayof if there are sufficient arguments. This permits checking strings like -d.
Diffstat (limited to 'generic/tkFont.c')
-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");