Merge "Added null checks to LayerDrawable implementation" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
6e4e9817b8
@@ -139,9 +139,12 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
|
|||||||
final ChildDrawable[] r = new ChildDrawable[length];
|
final ChildDrawable[] r = new ChildDrawable[length];
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
r[i] = new ChildDrawable(mLayerState.mDensity);
|
r[i] = new ChildDrawable(mLayerState.mDensity);
|
||||||
r[i].mDrawable = layers[i];
|
Drawable child = layers[i];
|
||||||
layers[i].setCallback(this);
|
r[i].mDrawable = child;
|
||||||
mLayerState.mChildrenChangingConfigurations |= layers[i].getChangingConfigurations();
|
if (child != null) {
|
||||||
|
child.setCallback(this);
|
||||||
|
mLayerState.mChildrenChangingConfigurations |= child.getChangingConfigurations();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mLayerState.mNumChildren = length;
|
mLayerState.mNumChildren = length;
|
||||||
mLayerState.mChildren = r;
|
mLayerState.mChildren = r;
|
||||||
@@ -416,7 +419,8 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
|
|||||||
final ChildDrawable[] layers = mLayerState.mChildren;
|
final ChildDrawable[] layers = mLayerState.mChildren;
|
||||||
final int N = mLayerState.mNumChildren;
|
final int N = mLayerState.mNumChildren;
|
||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < N; i++) {
|
||||||
if (layers[i].mDrawable.isProjected()) {
|
Drawable childDrawable = layers[i].mDrawable;
|
||||||
|
if (childDrawable != null && childDrawable.isProjected()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user