aboutsummaryrefslogtreecommitdiff
path: root/contrib/intarray/_int_tool.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/intarray/_int_tool.c')
-rw-r--r--contrib/intarray/_int_tool.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/contrib/intarray/_int_tool.c b/contrib/intarray/_int_tool.c
index 863557672ee..fc462b20766 100644
--- a/contrib/intarray/_int_tool.c
+++ b/contrib/intarray/_int_tool.c
@@ -246,6 +246,13 @@ resize_intArrayType(ArrayType *a, int num)
int nbytes = ARR_DATA_OFFSET(a) + sizeof(int) * num;
int i;
+ /* if no elements, return a zero-dimensional array */
+ if (num == 0)
+ {
+ ARR_NDIM(a) = 0;
+ return a;
+ }
+
if (num == ARRNELEMS(a))
return a;