Skip to content

Commit

Permalink
Fix crash in nativeInjectHMRUpdate (#22412)
Browse files Browse the repository at this point in the history
  • Loading branch information
vovkasm authored and kelset committed Nov 26, 2018
1 parent 44bfffb commit 0b4fd62
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ReactCommon/cxxreact/JSCExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ static JSValueRef nativeInjectHMRUpdate(
const JSValueRef arguments[],
JSValueRef* exception) {
String execJSString = Value(ctx, arguments[0]).toString();
String jsURL = Value(ctx, arguments[1]).toString();
// Temporary workaround for 0.57 and Metro 48 which did not pass second
// argument to this function.
// Actually we probably should to check both arguments before use and
// throw JS exception with suitable error string.
String jsURL = argumentCount > 1 ? Value(ctx, arguments[1]).toString() : String();
evaluateScript(ctx, execJSString, jsURL);
return Value::makeUndefined(ctx);
}
Expand Down

0 comments on commit 0b4fd62

Please sign in to comment.