summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-object.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/pdf/pdf-object.c')
-rw-r--r--source/pdf/pdf-object.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/pdf/pdf-object.c b/source/pdf/pdf-object.c
index 6f481942..f78fbadd 100644
--- a/source/pdf/pdf-object.c
+++ b/source/pdf/pdf-object.c
@@ -694,7 +694,12 @@ pdf_array_put(fz_context *ctx, pdf_obj *obj, int i, pdf_obj *item)
RESOLVE(obj);
if (!OBJ_IS_ARRAY(obj))
fz_throw(ctx, FZ_ERROR_GENERIC, "not an array (%s)", pdf_objkindstr(obj));
- if (i < 0 || i >= ARRAY(obj)->len)
+ if (i == ARRAY(obj)->len)
+ {
+ pdf_array_push(ctx, obj, item);
+ return;
+ }
+ if (i < 0 || i > ARRAY(obj)->len)
fz_throw(ctx, FZ_ERROR_GENERIC, "index out of bounds");
if (!item)