diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index d3d753b3ee8fb..2d48295673b87 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -20506,6 +20506,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @throws IllegalStateException if the drawable could not be found. */ @Nullable private Drawable getAutofilledDrawable() { + if (mAttachInfo == null) { + return null; + } // Lazily load the isAutofilled drawable. if (mAttachInfo.mAutofilledDrawable == null) { Context rootContext = getRootView().getContext();