Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 44702acd authored by Wenyi Wang's avatar Wenyi Wang
Browse files

Check for ImageView before casting it

Bug: 33273202

Test: manually verified the bug doesn't happen following steps to
      repro in bug

Change-Id: I4a50ff22fbb9235ded8060157f3a7f5cda19f6f2
parent e4ff97cc
Loading
Loading
Loading
Loading
+17 −15
Original line number Diff line number Diff line
@@ -448,11 +448,12 @@ public class ActionBarAdapter implements OnCloseListener {
                        final ArrayList<View> outViews = new ArrayList<>();
                        decorView.findViewsWithText(outViews, overflowDescription,
                                View.FIND_VIEWS_WITH_CONTENT_DESCRIPTION);
                        if (outViews.isEmpty()) {
                            return;

                        for (View view : outViews) {
                            if (!(view instanceof ImageView)) {
                                continue;
                            }
                        final ImageView overflow = (ImageView) outViews.get(0);
                        overflow.setImageResource(R.drawable.ic_more_vert);
                            final ImageView overflow = (ImageView) view;

                            // Update the overflow image color.
                            final int iconColor;
@@ -464,6 +465,7 @@ public class ActionBarAdapter implements OnCloseListener {
                                        R.color.actionbar_text_color);
                            }
                            overflow.setImageTintList(ColorStateList.valueOf(iconColor));
                        }

                        // We're done, remove the listener.
                        decorView.getViewTreeObserver().removeOnGlobalLayoutListener(this);