diff --git a/psycopg/typecast_array.c b/psycopg/typecast_array.c index b5f1062c..75fa1cfa 100644 --- a/psycopg/typecast_array.c +++ b/psycopg/typecast_array.c @@ -224,9 +224,9 @@ typecast_array_scan(const char *str, Py_ssize_t strlength, } else if (state == ASCAN_END) { - if (--stack_index < 0) + if (stack_index == 0) return -1; - array = stack[stack_index]; + array = stack[--stack_index]; } else if (state == ASCAN_EOF)