Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash in nativeInjectHMRUpdate #22412

Merged
merged 2 commits into from
Nov 26, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you mind just adding a comment for our future selves, something like

temporary workaround for 0.57 and Metro 48

so that if I encounter any issue in future releases/cherry-picks I can quickly remember what this was about?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :-)

evaluateScript(ctx, execJSString, jsURL);
return Value::makeUndefined(ctx);
}
Expand Down