Allow setAppearance to accept a null Appearance parameter without

throwing NPE.
This commit is contained in:
kruland2607 2013-04-22 09:23:45 -05:00
parent f899b9fb2e
commit 173108c1a8

View File

@ -426,6 +426,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
*/ */
public void setAppearance(Appearance appearance) { public void setAppearance(Appearance appearance) {
this.appearance = appearance; this.appearance = appearance;
if (this.appearance != null) {
Decal d = this.appearance.getTexture(); Decal d = this.appearance.getTexture();
if (d != null) { if (d != null) {
d.getImage().addChangeListener(new StateChangeListener() { d.getImage().addChangeListener(new StateChangeListener() {
@ -437,6 +438,8 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
}); });
} }
}
// CHECK - should this be a TEXTURE_CHANGE and not NONFUNCTIONAL_CHANGE?
fireComponentChangeEvent(ComponentChangeEvent.NONFUNCTIONAL_CHANGE); fireComponentChangeEvent(ComponentChangeEvent.NONFUNCTIONAL_CHANGE);
} }