Fix potential NPE in AbstractDraweeController#onFailureInternal
@@ -690,12 +690,15 @@ public abstract class AbstractDraweeController<T, INFO>
mDataSource = null;
mHasFetchFailed = true;
// Set the previously available image if available.
+ final SettableDraweeHierarchy hierarchy = mSettableDraweeHierarchy;
+ if (hierarchy != null) {
if (mRetainImageOnFailure && mDrawable != null) {
- mSettableDraweeHierarchy.setImage(mDrawable, 1f, true);
+ hierarchy.setImage(mDrawable, 1f, true);
} else if (shouldRetryOnTap()) {
- mSettableDraweeHierarchy.setRetry(throwable);
+ hierarchy.setRetry(throwable);
} else {
- mSettableDraweeHierarchy.setFailure(throwable);
+ hierarchy.setFailure(throwable);
+ }
}
reportFailure(throwable, dataSource);
// IMPORTANT: do not execute any instance-specific code after this point
