Skip to content

Commit d20b5e1

Browse files
sammy-SCfacebook-github-bot
authored andcommitted
Check for nullptr to prevent crash
Summary: Changelog: [internal] Prevent crash when casting of state to `ImageShadowNode::ConcreteState` fails. This doesn't fix root cause of the problem but stops the app from crashing. Reviewed By: JoshuaGross Differential Revision: D26604807 fbshipit-source-id: 17a2ead56ac68e560070ed4defd364a9d1dfd1e8
1 parent 7b09eb5 commit d20b5e1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ - (void)updateState:(State::Shared const &)state oldState:(State::Shared const &
8383

8484
bool havePreviousData = oldImageState && oldImageState->getData().getImageSource() != ImageSource{};
8585

86-
if (!havePreviousData || newImageState->getData().getImageSource() != oldImageState->getData().getImageSource()) {
86+
if (!havePreviousData ||
87+
(newImageState && newImageState->getData().getImageSource() != oldImageState->getData().getImageSource())) {
8788
// Loading actually starts a little before this, but this is the first time we know
8889
// the image is loading and can fire an event from this component
8990
std::static_pointer_cast<ImageEventEmitter const>(_eventEmitter)->onLoadStart();

0 commit comments

Comments
 (0)