diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2008-01-22 11:38:31 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2008-01-22 11:38:31 (GMT) |
commit | e8f77ac4b256a035643be895f8a3f8efbeae4081 (patch) | |
tree | d49bebfda586e207552bcff735bd73ccfe6458f6 /generic/tclCmdIL.c | |
parent | 7161eb819dfae3bb3413229cf70b6b47548cc2f9 (diff) | |
download | tcl-e8f77ac4b256a035643be895f8a3f8efbeae4081.zip tcl-e8f77ac4b256a035643be895f8a3f8efbeae4081.tar.gz tcl-e8f77ac4b256a035643be895f8a3f8efbeae4081.tar.bz2 |
* generic/tclCmdIl.c (Tcl_LreverseObjCmd):
* tests/cmdIL.test (cmdIL-7.7): fix crash on reversing an empty
list [Bug 1876793].
Diffstat (limited to 'generic/tclCmdIL.c')
-rw-r--r-- | generic/tclCmdIL.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index dccfc10..18a4a72 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -16,7 +16,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdIL.c,v 1.135 2007/12/26 19:26:08 msofer Exp $ + * RCS: @(#) $Id: tclCmdIL.c,v 1.136 2008/01/22 11:38:33 msofer Exp $ */ #include "tclInt.h" @@ -2609,6 +2609,15 @@ Tcl_LreverseObjCmd( return TCL_ERROR; } + /* + * If the list is empty, just return it [Bug 1876793] + */ + + if (!elemc) { + Tcl_SetObjResult(interp, objv[1]); + return TCL_OK; + } + if (Tcl_IsShared(objv[1])) { Tcl_Obj *resultObj, **dataArray; List *listPtr; |