summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <jan.nijtmans@noemail.net>2015-11-19 21:04:08 (GMT)
committerjan.nijtmans <jan.nijtmans@noemail.net>2015-11-19 21:04:08 (GMT)
commit7b672aaf21b1d7ef73c504907aabb1f24a370128 (patch)
treea6b9ec5271f3cce6bf256e9378132f0a7a0089cc /generic
parent1c0b64fb79bbdb5748adf701b6a30ba0d9581e53 (diff)
downloadtk-7b672aaf21b1d7ef73c504907aabb1f24a370128.zip
tk-7b672aaf21b1d7ef73c504907aabb1f24a370128.tar.gz
tk-7b672aaf21b1d7ef73c504907aabb1f24a370128.tar.bz2
better argument checking
FossilOrigin-Name: 70ea2f724cdcda78663a5e3887aa053092344056
Diffstat (limited to 'generic')
-rw-r--r--generic/tkText.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/generic/tkText.c b/generic/tkText.c
index 2c4d54c..9cae716 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -1508,8 +1508,14 @@ TextWidgetObjCmd(
result = TkTextXviewCmd(textPtr, interp, objc, objv);
break;
case TEXT_YUPDATE: {
- if ((objc == 4) && !strncmp(Tcl_GetString(objv[2]), "-command", objv[3]->length)) {
+ if (objc == 4) {
Tcl_Obj *cmd = objv[3];
+ const char *option = Tcl_GetString(objv[2]);
+ if (strncmp(option, "-command", objv[2]->length)) {
+ Tcl_AppendResult(interp, "wrong option \"", option, "\": should be \"-command\"", NULL);
+ result = TCL_ERROR;
+ goto done;
+ }
Tcl_IncrRefCount(cmd);
if (TkTextPendingyupdate(textPtr)) {
if (textPtr->linesUpdatedCmd) {