diff --git a/ReactCommon/cxxreact/Instance.cpp b/ReactCommon/cxxreact/Instance.cpp index 9840973c6..1ac0885f2 100644 --- a/ReactCommon/cxxreact/Instance.cpp +++ b/ReactCommon/cxxreact/Instance.cpp @@ -73,10 +73,16 @@ void Instance::loadScriptFromFile(const std::string& filename, "fileName", filename); std::unique_ptr script; - RecoverableError::runRethrowingAsRecoverable( - [&filename, &script]() { - script = JSBigFileString::fromPath(filename); - }); + + // This function can be called in order to change the Bridge's Source URL. + // In that case, the filename will be empty, and we should not attempt to + // load it. + if (!filename.empty()) { + RecoverableError::runRethrowingAsRecoverable( + [&filename, &script]() { + script = JSBigFileString::fromPath(filename); + }); + } nativeToJsBridge_->loadApplication(nullptr, std::move(script), sourceURL); }