diff options
author | kennykb <kennykb@noemail.net> | 2008-06-17 02:16:06 (GMT) |
---|---|---|
committer | kennykb <kennykb@noemail.net> | 2008-06-17 02:16:06 (GMT) |
commit | 8dd4d0fb659628561a6a162f8c44b12bc4b3f0a5 (patch) | |
tree | ef258c0fb1e1a85526a0e6ed5936cc7b4084de06 /generic/tclClock.c | |
parent | 9c7ff21f104276382949ce9f56202a44dcd02e58 (diff) | |
download | tcl-8dd4d0fb659628561a6a162f8c44b12bc4b3f0a5.zip tcl-8dd4d0fb659628561a6a162f8c44b12bc4b3f0a5.tar.gz tcl-8dd4d0fb659628561a6a162f8c44b12bc4b3f0a5.tar.bz2 |
2006-06-17 Kevin Kenny <kennykb@acm.org>
* generic/tclClock.c (ConvertLocalToUTC):
* tests/clock.test (clock-63.1): Fixed a bug where the
internal ConvertLocalToUTC command segfaulted if passed a
dictionary without the 'localSeconds' key. To the best of
my knowledge, the bug was not observable in the [clock]
command itself.
FossilOrigin-Name: b108b4c3a8dfaa8fac56156a2efd76c8a865b5c5
Diffstat (limited to 'generic/tclClock.c')
-rw-r--r-- | generic/tclClock.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/generic/tclClock.c b/generic/tclClock.c index 12c2e64..a27deb6 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclClock.c,v 1.66 2008/02/27 02:08:27 kennykb Exp $ + * RCS: @(#) $Id: tclClock.c,v 1.67 2008/06/17 02:16:06 kennykb Exp $ */ #include "tclInt.h" @@ -333,12 +333,20 @@ ClockConvertlocaltoutcObjCmd( return TCL_ERROR; } dict = objv[1]; - if ((Tcl_DictObjGet(interp, dict, literals[LIT_LOCALSECONDS], - &secondsObj) != TCL_OK) - || (Tcl_GetWideIntFromObj(interp, secondsObj, - &(fields.localSeconds)) != TCL_OK) - || (TclGetIntFromObj(interp, objv[3], &changeover) != TCL_OK) - || ConvertLocalToUTC(interp, &fields, objv[2], changeover)) { + if (Tcl_DictObjGet(interp, dict, literals[LIT_LOCALSECONDS], + &secondsObj)!= TCL_OK) { + fprintf(stderr, "fell out here\n"); fflush(stderr); + return TCL_ERROR; + } + if (secondsObj == NULL) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("key \"localseconds\" not " + "found in dictionary", -1)); + return TCL_ERROR; + } + if ((Tcl_GetWideIntFromObj(interp, secondsObj, + &(fields.localSeconds)) != TCL_OK) + || (TclGetIntFromObj(interp, objv[3], &changeover) != TCL_OK) + || ConvertLocalToUTC(interp, &fields, objv[2], changeover)) { return TCL_ERROR; } |