History

arrayget: return errors instead of aborting

Noam Preil committed 4 years ago

Commit 46d81641 parent 488ad621 file · +4 −2Browse files

Showing the changes to array.c (1 of 1 file). Show all

Unified · Split

array.c+4−2
@@ -83,8 +83,10 @@ arraylen(Object *o) · 82 unmodified lines
8383 Object *
8484 arrayget(Object *o, int i)
8585 {
86− if(arraylen(o) <= i)
87− sysfatal("array: indexing out of range");
86+ if(arraylen(o) <= i){
87+ werrstr("arrayget: indexing out of range");
88+ return &null;
89+ }
8890 o = o->type == Oarray ? o->array.e[i] : o;
8991
9092 return pdfeval(o);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t