v3.0.0: added a safety check to alchemy scene creation
This commit is contained in:
+10
-1
@@ -220,7 +220,16 @@ public class AlchemyScene extends PixelScene {
|
|||||||
|
|
||||||
synchronized (inputs) {
|
synchronized (inputs) {
|
||||||
for (int i = 0; i < inputs.length; i++) {
|
for (int i = 0; i < inputs.length; i++) {
|
||||||
inputs[i] = new InputButton();
|
if (inputs[i] == null) {
|
||||||
|
inputs[i] = new InputButton();
|
||||||
|
} else {
|
||||||
|
//in case the scene was reset without calling destroy() for some reason
|
||||||
|
Item item = inputs[i].item();
|
||||||
|
inputs[i] = new InputButton();
|
||||||
|
if (item != null){
|
||||||
|
inputs[i].item(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
inputs[i].setRect(left + 10, pos, BTN_SIZE, BTN_SIZE);
|
inputs[i].setRect(left + 10, pos, BTN_SIZE, BTN_SIZE);
|
||||||
add(inputs[i]);
|
add(inputs[i]);
|
||||||
pos += BTN_SIZE + 2;
|
pos += BTN_SIZE + 2;
|
||||||
|
|||||||
Reference in New Issue
Block a user