1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2024-12-22 17:45:32 +02:00

inst.h (FOR_PKG_INSTS): protect against active_pkg == NULL

active_pkg can become NULL if the root frame contains a loop that
will never execute, i.e., loop x = 1, 0

This caused fped to segfault when FOR_PKG_INSTS was called from
FOR_ALL_INSTS in inst_draw.
This commit is contained in:
Werner Almesberger 2012-05-25 18:21:09 -03:00
parent 424b74e482
commit b06ed92557

2
inst.h
View File

@ -155,7 +155,7 @@ extern struct inst *frame_instantiating;
for (prio = ip_n-1; prio != (enum inst_prio) -1; prio--)
#define FOR_PKG_INSTS(pkg, prio, inst) \
for (inst = (pkg)->insts[prio]; inst; inst = inst->next)
for (inst = (pkg) ? (pkg)->insts[prio] : NULL; inst; inst = inst->next)
#define FOR_ALL_INSTS(i, prio, inst) \
for (i = 0; i != 2; i++) \