Index: src/runtime/runtime-strings.cc |
diff --git a/src/runtime/runtime-strings.cc b/src/runtime/runtime-strings.cc |
index 5704807b82b60a62e0887efce7423d7e4e124ec6..49ce1a72575d28e420dabe5ba321f926e30e2793 100644 |
--- a/src/runtime/runtime-strings.cc |
+++ b/src/runtime/runtime-strings.cc |
@@ -121,11 +121,13 @@ RUNTIME_FUNCTION(Runtime_StringReplaceOneCharWithString) { |
if (isolate->has_pending_exception()) return isolate->heap()->exception(); |
subject = String::Flatten(subject); |
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
- isolate, result, |
- StringReplaceOneCharWithString(isolate, subject, search, replace, &found, |
- kRecursionLimit)); |
- return *result; |
+ if (StringReplaceOneCharWithString(isolate, subject, search, replace, &found, |
+ kRecursionLimit).ToHandle(&result)) { |
+ return *result; |
+ } |
+ if (isolate->has_pending_exception()) return isolate->heap()->exception(); |
+ // In case of empty handle and no pending exception we have stack overflow. |
+ return isolate->StackOverflow(); |
} |