Nullcheck before dispatching view command

Summary:
Changelog: [internal]

`shadowNodeFromValue` can return nullptr. Let's make sure it returns valid value before dispatching command.

Reviewed By: JoshuaGross

Differential Revision: D26605350

fbshipit-source-id: eb9a0347c95ba07fd7e9b7ddeca7e6d6011f50ad
This commit is contained in:
Samuel Susla
2021-02-24 01:57:14 -08:00
committed by Facebook GitHub Bot
parent e67811e7a6
commit f7eecc68cb
@@ -534,11 +534,13 @@ jsi::Value UIManagerBinding::get(
jsi::Value const &thisValue,
jsi::Value const *arguments,
size_t count) noexcept -> jsi::Value {
uiManager->dispatchCommand(
shadowNodeFromValue(runtime, arguments[0]),
stringFromValue(runtime, arguments[1]),
commandArgsFromValue(runtime, arguments[2]));
auto shadowNode = shadowNodeFromValue(runtime, arguments[0]);
if (shadowNode) {
uiManager->dispatchCommand(
shadowNodeFromValue(runtime, arguments[0]),
stringFromValue(runtime, arguments[1]),
commandArgsFromValue(runtime, arguments[2]));
}
return jsi::Value::undefined();
});
}