Skip to content

Commit

Permalink
fix(android): check imageAdapter result before use
Browse files Browse the repository at this point in the history
  • Loading branch information
iPel authored and zealotchen0 committed Aug 7, 2023
1 parent 8fad0f3 commit c8c16c2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,13 @@ protected void handleImageRequest(IDrawableTarget target, int sourceType, Object
}
}

@Override
protected boolean hasImage(IDrawableTarget resultDrawable) {
return (resultDrawable != null && resultDrawable.getBitmap() != null)
|| (resultDrawable != null && resultDrawable.getDrawable() != null)
|| (resultDrawable instanceof HippyDrawable && ((HippyDrawable) resultDrawable).getGIF() != null);
}

@Override
public void setBorderRadius(float radius, int position) {
super.setBorderRadius(radius, position);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ public void onRequestFail(Throwable throwable, String source)
}

protected void handleImageRequest(IDrawableTarget resultDrawable, int sourceType, Object requestInfo) {
if (resultDrawable == null) {
if (!hasImage(resultDrawable)) {
if (sourceType == SOURCE_TYPE_SRC) {
mSourceDrawable = null;
if (mDefaultSourceDrawable != null) {
Expand All @@ -364,6 +364,10 @@ protected void handleImageRequest(IDrawableTarget resultDrawable, int sourceType
}
}

protected boolean hasImage(IDrawableTarget resultDrawable) {
return resultDrawable != null;
}

protected ContentDrawable generateContentDrawable()
{
return new ContentDrawable();
Expand Down

0 comments on commit c8c16c2

Please sign in to comment.