diff --git a/Libraries/Core/Devtools/getDevServer.js b/Libraries/Core/Devtools/getDevServer.js index e413709da..975a75f82 100644 --- a/Libraries/Core/Devtools/getDevServer.js +++ b/Libraries/Core/Devtools/getDevServer.js @@ -25,7 +25,7 @@ type DevServerInfo = { */ function getDevServer(): DevServerInfo { if (_cachedDevServerURL === undefined) { - const match = SourceCode.scriptURL && SourceCode.scriptURL.match(/^https?:\/\/.*?\//); + const match = SourceCode && SourceCode.scriptURL && SourceCode.scriptURL.match(/^https?:\/\/.*?\//); _cachedDevServerURL = match ? match[0] : null; } diff --git a/Libraries/Image/resolveAssetSource.js b/Libraries/Image/resolveAssetSource.js index a5b6229d3..24fec6ef3 100644 --- a/Libraries/Image/resolveAssetSource.js +++ b/Libraries/Image/resolveAssetSource.js @@ -92,7 +92,7 @@ if (!sourceCode) { const NativeModules = require('NativeModules'); sourceCode = NativeModules && NativeModules.SourceCode; } -_sourceCodeScriptURL = sourceCode.scriptURL; +_sourceCodeScriptURL = sourceCode && sourceCode.scriptURL; module.exports = resolveAssetSource; module.exports.pickScale = AssetSourceResolver.pickScale;