]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
better err checks in resizetuple
authorGuido van Rossum <guido@python.org>
Fri, 4 Aug 1995 04:05:10 +0000 (04:05 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 4 Aug 1995 04:05:10 +0000 (04:05 +0000)
Objects/tupleobject.c

index 7fae2647b0dcac44e0e0c0591d6067d5bfe0fd04..2218e503200eb067edc43f14ddf3957467ce2d8e 100644 (file)
@@ -408,13 +408,13 @@ resizetuple(pv, newsize, last_is_sticky)
        int sizediff;
 
        v = (tupleobject *) *pv;
-       sizediff = newsize - v->ob_size;
-       if (!is_tupleobject(v) || v->ob_refcnt != 1) {
+       if (v == NULL || !is_tupleobject(v) || v->ob_refcnt != 1) {
                *pv = 0;
                DECREF(v);
                err_badcall();
                return -1;
        }
+       sizediff = newsize - v->ob_size;
        if (sizediff == 0)
                return 0;
        /* XXX UNREF/NEWREF interface should be more symmetrical */