Fabric: Fixed a crash in RCTImageComponentView

Summary: The app crashed on assert which was not actually legit. See the comment in the code.

Reviewed By: JoshuaGross

Differential Revision: D15976177

fbshipit-source-id: 612bbbd510187ffdc86369aa943d4b652b748694
This commit is contained in:
Valentin Shergin
2019-06-24 17:17:47 -07:00
committed by Facebook Github Bot
parent 7d2a95d43d
commit 970bd2c69c
@@ -78,7 +78,13 @@
{
SharedImageLocalData previousData = _imageLocalData;
_imageLocalData = std::static_pointer_cast<const ImageLocalData>(localData);
assert(_imageLocalData);
if (!_imageLocalData) {
// This might happen in very rare cases (e.g. inside a subtree inside a node with `display: none`).
// That's quite normal.
return;
}
bool havePreviousData = previousData != nullptr;
if (!havePreviousData || _imageLocalData->getImageSource() != previousData->getImageSource()) {