diff options
Diffstat (limited to 'generic/tkCanvPoly.c')
-rw-r--r-- | generic/tkCanvPoly.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c index b3f5374..5058b9f 100644 --- a/generic/tkCanvPoly.c +++ b/generic/tkCanvPoly.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCanvPoly.c,v 1.9 2002/08/05 04:30:38 dgp Exp $ + * RCS: @(#) $Id: tkCanvPoly.c,v 1.10 2003/02/09 07:48:22 hobbs Exp $ */ #include <stdio.h> @@ -266,6 +266,10 @@ CreatePolygon(interp, canvas, itemPtr, objc, objv) PolygonItem *polyPtr = (PolygonItem *) itemPtr; int i; + if (objc == 0) { + panic("canvas did not pass any coords\n"); + } + /* * Carry out initialization that is needed in order to clean * up after errors during the the remainder of this procedure. @@ -368,9 +372,10 @@ PolygonCoords(interp, canvas, itemPtr, objc, objv) } } if (objc & 1) { - Tcl_AppendResult(interp, - "odd number of coordinates specified for polygon", - (char *) NULL); + char buf[64 + TCL_INTEGER_SPACE]; + sprintf(buf, "wrong # coordinates: expected an even number, got %d", + objc); + Tcl_SetResult(interp, buf, TCL_VOLATILE); return TCL_ERROR; } else { numPoints = objc/2; |