forked from M-Labs/artiq
1
0
Fork 0

soc/runtime/exceptions: do not crash when exception is raised with no handler

This commit is contained in:
Sebastien Bourdeauducq 2014-10-05 10:33:27 +08:00
parent 76fed11d59
commit 5d8c53abb3
1 changed files with 5 additions and 2 deletions

View File

@ -30,6 +30,9 @@ int exception_getid(void)
void exception_raise(int id)
{
stored_id = id;
exception_longjmp(exception_contexts[--ec_top].jb);
if(ec_top > 0) {
stored_id = id;
exception_longjmp(exception_contexts[--ec_top].jb);
} else
corecom_log("WARNING: uncaught exception, ID=%d\n", id);
}