mirror of
https://github.com/material-components/material-components-android.git
synced 2026-02-04 19:48:23 +08:00
[MaterialToolbar] Add null check for logo ConstantState check
Resolves https://github.com/material-components/material-components-android/issues/2708 PiperOrigin-RevId: 449305810
This commit is contained in:
parent
722756e389
commit
2ac796fdf4
@ -90,12 +90,17 @@ public class ToolbarUtils {
|
||||
|
||||
@Nullable
|
||||
private static ImageView getImageView(@NonNull Toolbar toolbar, @Nullable Drawable content) {
|
||||
if (content == null) {
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < toolbar.getChildCount(); i++) {
|
||||
View child = toolbar.getChildAt(i);
|
||||
if (child instanceof ImageView) {
|
||||
ImageView imageView = (ImageView) child;
|
||||
if (content != null
|
||||
&& imageView.getDrawable().getConstantState().equals(content.getConstantState())) {
|
||||
Drawable drawable = imageView.getDrawable();
|
||||
if (drawable != null
|
||||
&& drawable.getConstantState() != null
|
||||
&& drawable.getConstantState().equals(content.getConstantState())) {
|
||||
return imageView;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user