diff options
Diffstat (limited to 'generic/tkText.c')
-rw-r--r-- | generic/tkText.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/generic/tkText.c b/generic/tkText.c index c293557..3114835 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -5232,13 +5232,15 @@ TextEditCmd( } break; case EDIT_REDODEPTH: { - int depth; + int depth = 0; if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); return TCL_ERROR; } - depth = TkUndoGetDepth(textPtr->sharedTextPtr->undoStack, 1); + if (textPtr->sharedTextPtr->undo) { + depth = TkUndoGetDepth(textPtr->sharedTextPtr->undoStack, 1); + } Tcl_SetObjResult(interp, Tcl_NewIntObj(depth)); break; } @@ -5268,13 +5270,15 @@ TextEditCmd( } break; case EDIT_UNDODEPTH: { - int depth; + int depth = 0; if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); return TCL_ERROR; } - depth = TkUndoGetDepth(textPtr->sharedTextPtr->undoStack, 0); + if (textPtr->sharedTextPtr->undo) { + depth = TkUndoGetDepth(textPtr->sharedTextPtr->undoStack, 0); + } Tcl_SetObjResult(interp, Tcl_NewIntObj(depth)); break; } |