Fix NullPointerException in DrawableContainer.mutate()

DrawableContainerState.mDrawables is an array which may be only partially
filled, as can be seen in the constructor and the addChild() method.

DrawableContainer.mutate() wrongly assumed that the array does not contain
null references.
This commit is contained in:
Phil Dubach
2009-06-29 16:57:46 -07:00
parent 66c2942a11
commit 6be507cc66

View File

@@ -234,8 +234,10 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
@Override
public Drawable mutate() {
if (!mMutated && super.mutate() == this) {
for (Drawable child : mDrawableContainerState.mDrawables) {
child.mutate();
final int N = mDrawableContainerState.getChildCount();
final Drawable[] drawables = mDrawableContainerState.getChildren();
for (int i = 0; i < N; i++) {
drawables[i].mutate();
}
mMutated = true;
}