Trying to build an exception may itself raise an exception

This commit is contained in:
K. Lange 2022-08-05 10:10:24 +09:00
parent 5d9d33e10e
commit 1129323cff

View File

@ -408,11 +408,13 @@ void krk_raiseException(KrkValue base, KrkValue cause) {
if (IS_CLASS(base)) {
krk_push(base);
base = krk_callStack(0);
if (krk_currentThread.flags & KRK_THREAD_HAS_EXCEPTION) return;
}
krk_currentThread.currentException = base;
if (IS_CLASS(cause)) {
krk_push(cause);
cause = krk_callStack(0);
if (krk_currentThread.flags & KRK_THREAD_HAS_EXCEPTION) return;
}
if (IS_INSTANCE(krk_currentThread.currentException) && !IS_NONE(cause)) {
krk_attachNamedValue(&AS_INSTANCE(krk_currentThread.currentException)->fields,