From 1d828addc02ff58665dd69cae763a3c32ac17da9 Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Sun, 3 Jul 2022 18:44:47 +0900 Subject: [PATCH] Bail early if _eq raises an exception --- src/value.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/value.c b/src/value.c index 9774c14..20441af 100644 --- a/src/value.c +++ b/src/value.c @@ -174,6 +174,7 @@ int krk_valuesEqual(KrkValue a, KrkValue b) { krk_push(a); krk_push(b); KrkValue result = krk_callDirect(type->_eq,2); + if (unlikely(krk_currentThread.flags & KRK_THREAD_HAS_EXCEPTION)) return 0; if (IS_BOOLEAN(result)) return AS_BOOLEAN(result); if (IS_NOTIMPL(result)) goto _next; return !krk_isFalsey(result); @@ -186,6 +187,7 @@ _next: krk_push(a); KrkValue result = krk_callDirect(type->_eq,2); if (IS_BOOLEAN(result)) return AS_BOOLEAN(result); + if (unlikely(krk_currentThread.flags & KRK_THREAD_HAS_EXCEPTION)) return 0; return !krk_isFalsey(result); }