Add null check in ViewOverlay

View.getOverlay().clear() can failed with an NPE if there are
no drawables in the overlay. Fix: add a null check before dereferencing
the mDrawables field.

Issue #8895794 getOverlay.clear() crashes if drawables were not added previously

Change-Id: I9b2a63036450915681ba3a89a0911e2490063702
This commit is contained in:
Chet Haase
2013-05-20 06:46:11 -07:00
parent 30c798d587
commit d8b0b23324

View File

@ -179,7 +179,9 @@ public class ViewOverlay {
public void clear() {
removeAllViews();
mDrawables.clear();
if (mDrawables != null) {
mDrawables.clear();
}
}
boolean isEmpty() {