Merge "Fix regression, don't NPE if Switch doesn't have a thumb set" into lmp-mr1-dev
diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java
index 4c8aa51..7a22224 100644
--- a/core/java/android/widget/Switch.java
+++ b/core/java/android/widget/Switch.java
@@ -689,6 +689,10 @@
* @return true if (x, y) is within the target area of the switch thumb
*/
private boolean hitThumb(float x, float y) {
+ if (mThumbDrawable == null) {
+ return false;
+ }
+
// Relies on mTempRect, MUST be called first!
final int thumbOffset = getThumbOffset();