mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
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:
parent
aa727d22a1
commit
22bedcec9e
1 changed files with 7 additions and 1 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue