From 5d8c53abb3269c2a1ce387196f232a7973060340 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 5 Oct 2014 10:33:27 +0800 Subject: [PATCH] soc/runtime/exceptions: do not crash when exception is raised with no handler --- soc/runtime/exceptions.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/soc/runtime/exceptions.c b/soc/runtime/exceptions.c index d6c2e9d10..edf54c95a 100644 --- a/soc/runtime/exceptions.c +++ b/soc/runtime/exceptions.c @@ -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); }