Skip to content

Commit 0b4fd62

Browse files
vovkasmkelset
authored andcommittedNov 26, 2018
Fix crash in nativeInjectHMRUpdate (#22412)
1 parent 44bfffb commit 0b4fd62

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎ReactCommon/cxxreact/JSCExecutor.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ static JSValueRef nativeInjectHMRUpdate(
113113
const JSValueRef arguments[],
114114
JSValueRef* exception) {
115115
String execJSString = Value(ctx, arguments[0]).toString();
116-
String jsURL = Value(ctx, arguments[1]).toString();
116+
// Temporary workaround for 0.57 and Metro 48 which did not pass second
117+
// argument to this function.
118+
// Actually we probably should to check both arguments before use and
119+
// throw JS exception with suitable error string.
120+
String jsURL = argumentCount > 1 ? Value(ctx, arguments[1]).toString() : String();
117121
evaluateScript(ctx, execJSString, jsURL);
118122
return Value::makeUndefined(ctx);
119123
}

0 commit comments

Comments
 (0)
Please sign in to comment.