Fix potential crash in ImageTransformState

android.graphics.drawable.Icon#sameAs() requires a non-null icon object
to do compare.

Bug: 264608650
Test: Manual
Change-Id: I0625ebce8c368d621e40be0162a023427a911083
This commit is contained in:
Shen Lin
2023-01-06 23:06:59 +08:00
parent e073b7ed65
commit ccaeb5a470

View File

@@ -53,7 +53,9 @@ public class ImageTransformState extends TransformState {
return true;
}
if (otherState instanceof ImageTransformState) {
return mIcon != null && mIcon.sameAs(((ImageTransformState) otherState).getIcon());
final Icon otherIcon = ((ImageTransformState) otherState).mIcon;
return mIcon == otherIcon || (mIcon != null && otherIcon != null && mIcon.sameAs(
otherIcon));
}
return false;
}