mirror of
https://github.com/status-im/react-native.git
synced 2025-01-30 03:05:44 +00:00
Redbox on DrawImageWithDrawee exception
Summary: DrawImageWithDrawee has caused NPEs when using Nodes in various cases in RNFeed. This patch explicitly throws a RuntimeException, so that we can debug as to whether this is coming from bad sources or a bad size for the image. Differential Revision: D3574998
This commit is contained in:
parent
bb5ba3d295
commit
d89e7475fb
@ -142,14 +142,25 @@ import com.facebook.react.views.imagehelper.MultiSourceHelper.MultiSourceResult;
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas) {
|
||||
Assertions.assumeNotNull(mRequestHelper).getDrawable().draw(canvas);
|
||||
if (mRequestHelper != null) {
|
||||
mRequestHelper.getDrawable().draw(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttached(FlatViewGroup.InvalidateCallback callback) {
|
||||
mCallback = callback;
|
||||
|
||||
GenericDraweeHierarchy hierarchy = Assertions.assumeNotNull(mRequestHelper).getHierarchy();
|
||||
if (mRequestHelper == null) {
|
||||
// this is here to help us debug t12048319, in which we have a null request helper on attach
|
||||
throw new RuntimeException(
|
||||
"No DraweeRequestHelper - width: " +
|
||||
(getRight() - getLeft()) +
|
||||
" - height: " + (getBottom() - getTop() +
|
||||
" - number of sources: " + mSources.size()));
|
||||
}
|
||||
|
||||
GenericDraweeHierarchy hierarchy = mRequestHelper.getHierarchy();
|
||||
|
||||
RoundingParams roundingParams = hierarchy.getRoundingParams();
|
||||
if (shouldDisplayBorder()) {
|
||||
@ -182,7 +193,9 @@ import com.facebook.react.views.imagehelper.MultiSourceHelper.MultiSourceResult;
|
||||
|
||||
@Override
|
||||
public void onDetached() {
|
||||
Assertions.assumeNotNull(mRequestHelper).detach();
|
||||
if (mRequestHelper != null) {
|
||||
mRequestHelper.detach();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user