diff options
Diffstat (limited to 'ext/tk/tcltklib.c')
-rw-r--r-- | ext/tk/tcltklib.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/tk/tcltklib.c b/ext/tk/tcltklib.c index e93fc04cc..67a9b7538 100644 --- a/ext/tk/tcltklib.c +++ b/ext/tk/tcltklib.c @@ -2860,16 +2860,17 @@ ip_RubyExitCommand(clientData, interp, argc, argv) case 2: #if TCL_MAJOR_VERSION >= 8 - if (!Tcl_GetIntFromObj(interp, argv[1], &state)) { + if (Tcl_GetIntFromObj(interp, argv[1], &state) == TCL_ERROR) { return TCL_ERROR; } param = Tcl_GetString(argv[1]); #else /* TCL_MAJOR_VERSION < 8 */ state = (int)strtol(argv[1], &endptr, 0); - if (endptr) { + if (*endptr) { Tcl_AppendResult(interp, "expected integer but got \"", argv[1], "\"", (char *)NULL); + return TCL_ERROR; } param = argv[1]; #endif |