fix: Prevent possible crash in log error handler

This commit is contained in:
Marc Rousavy 2023-02-15 18:15:13 +01:00
parent 6825c1f587
commit 222ded4728

View File

@ -41,7 +41,7 @@ FrameProcessorCallback convertWorkletToFrameProcessorCallback(jsi::Runtime& runt
auto message = [NSString stringWithFormat:@"Frame Processor threw an error: %s\nIn: %s", jsError.getMessage().c_str(), stack.c_str()]; auto message = [NSString stringWithFormat:@"Frame Processor threw an error: %s\nIn: %s", jsError.getMessage().c_str(), stack.c_str()];
RCTBridge* bridge = [RCTBridge currentBridge]; RCTBridge* bridge = [RCTBridge currentBridge];
if (bridge != nil) { if (bridge != nil && bridge.jsCallInvoker != nullptr) {
bridge.jsCallInvoker->invokeAsync([bridge, message]() { bridge.jsCallInvoker->invokeAsync([bridge, message]() {
auto logFn = [JSConsoleHelper getLogFunctionForBridge:bridge]; auto logFn = [JSConsoleHelper getLogFunctionForBridge:bridge];
logFn(RCTLogLevelError, message); logFn(RCTLogLevelError, message);