From 055968c06844498fc4e8e6bdefe737828b8525ca Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 4 Aug 1995 04:05:10 +0000 Subject: [PATCH] better err checks in resizetuple --- Objects/tupleobject.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index 7fae2647b0d..2218e503200 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -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 */