shithub: pdffs

Download patch

ref: 46d81647ed29df0395eed990b8bfcbbc929c8d2b
parent: 488ad626470fd67f028be2b04d515732ebcb9b5c
author: Noam Preil <[email protected]>
date: Wed Apr 20 17:45:46 EDT 2022

arrayget: return errors instead of aborting

--- a/array.c
+++ b/array.c
@@ -83,8 +83,10 @@
 Object *
 arrayget(Object *o, int i)
 {
-	if(arraylen(o) <= i)
-		sysfatal("array: indexing out of range");
+	if(arraylen(o) <= i){
+		werrstr("arrayget: indexing out of range");
+		return &null;
+	}
 	o = o->type == Oarray ? o->array.e[i] : o;
 
 	return pdfeval(o);