In Evaluator::EvaluatorResult::resultOrErrorToString error can be null even if the task was successful

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
This commit is contained in:
Seonghyun Kim 2026-04-29 20:29:44 +09:00 committed by MuHong Byun
commit 22bedcec9e

View file

@ -1265,7 +1265,13 @@ StringRef* Evaluator::EvaluatorResult::resultOrErrorToString(ContextRef* ctx) co
if (isSuccessful()) {
return result->toStringWithoutException(ctx);
} else {
return ((ValueRef*)error.value())->toStringWithoutException(ctx);
// Check if error value is valid before dereferencing
// In some edge cases (e.g., nested eval throw with finally allocation),
// the error value might be invalid or null
if (error.hasValue()) {
return ((ValueRef*)error.value())->toStringWithoutException(ctx);
}
return StringRef::emptyString();
}
}