From 5d84aba7fcac9b0ae61c91cbf5e67aa2285e1e0f Mon Sep 17 00:00:00 2001 From: Kirill Grouchnikov Date: Tue, 14 Mar 2017 23:49:01 +0000 Subject: [PATCH] Remove unnecessary null check If that variable is null, it would crash in the previous line Bug: 34129526 Test: run a few design lib tests Change-Id: Ic403d4ccf79899f4d2978856fbb02ffc65de0f3f PiperOrigin-RevId: 150132347 --- lib/src/android/support/design/widget/ThemeUtils.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/src/android/support/design/widget/ThemeUtils.java b/lib/src/android/support/design/widget/ThemeUtils.java index 1716dfabf..87da3ab85 100644 --- a/lib/src/android/support/design/widget/ThemeUtils.java +++ b/lib/src/android/support/design/widget/ThemeUtils.java @@ -28,9 +28,8 @@ class ThemeUtils { static void checkAppCompatTheme(Context context) { TypedArray a = context.obtainStyledAttributes(APPCOMPAT_CHECK_ATTRS); final boolean failed = !a.hasValue(0); - if (a != null) { - a.recycle(); - } + a.recycle(); + if (failed) { throw new IllegalArgumentException( "You need to use a Theme.AppCompat theme " + "(or descendant) with the design library.");