Skip to content

Commit

Permalink
[0.63] Have script store return nullptr on facebook::jsi::JSINativeEx…
Browse files Browse the repository at this point in the history
…ception (#8080)

* Have script store return nullptr on facebook::jsi::JSINativeException (#8068)

* Return nullptr on facebook::jsi::JSINativeException

* Change files

* Remove unused exception name

* Clean up change files

* Change files
  • Loading branch information
JunielKatarn committed Jun 22, 2021
1 parent 3ddd4e2 commit 2803ec0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "patch",
"comment": "Have script store return nullptr on facebook::jsi::JSINativeException (#8068)",
"packageName": "react-native-windows",
"email": "julio.rocha@microsoft.com",
"dependentChangeType": "patch",
"date": "2021-06-22T02:27:18.775Z"
}
6 changes: 5 additions & 1 deletion vnext/Shared/BaseScriptStoreImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ std::unique_ptr<const jsi::Buffer> LocalFileSimpleBufferStore::getBuffer(const s
}

if (Microsoft::React::GetRuntimeOptionBool("JSI.MemoryMappedScriptStore")) {
return Microsoft::JSI::MakeMemoryMappedBuffer(winrt::to_hstring(storeDirectory_ + bufferId).c_str());
try {
return Microsoft::JSI::MakeMemoryMappedBuffer(winrt::to_hstring(storeDirectory_ + bufferId).c_str());
} catch (const facebook::jsi::JSINativeException &) {
return nullptr;
}
} else {
// Treat buffer id as the relative path fragment.
std::ifstream file(storeDirectory_ + bufferId, std::ios::binary | std::ios::ate);
Expand Down

0 comments on commit 2803ec0

Please sign in to comment.