From 154e1833443f0fc32f9cb8df1846e08f8f30aec6 Mon Sep 17 00:00:00 2001 From: Ashok Menon Date: Thu, 12 Jan 2017 16:21:31 -0800 Subject: [PATCH] Fixing RN Debugger Reviewed By: cwdick, javache Differential Revision: D4409257 fbshipit-source-id: 062c798d1a1c9ad90884599ed262412c1dd51359 --- ReactCommon/cxxreact/Instance.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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); }