mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-04-19 10:36:43 +00:00
Fixed crash when an empty item is cleared.
This commit is contained in:
parent
292f737971
commit
ad16df32d7
@ -55,14 +55,19 @@ public class CubotInventory extends HardwareModule {
|
|||||||
private void scanItem() {
|
private void scanItem() {
|
||||||
int x = getCpu().getRegisterSet().getRegister("X").getValue();
|
int x = getCpu().getRegisterSet().getRegister("X").getValue();
|
||||||
Item item = inventory.get(position);
|
Item item = inventory.get(position);
|
||||||
|
if (item != null) {
|
||||||
|
item.clear(unit);
|
||||||
|
inventory.remove(position);
|
||||||
item.digitize(unit.getCpu().getMemory(), x);
|
item.digitize(unit.getCpu().getMemory(), x);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Item clearItem() {
|
public Item clearItem() {
|
||||||
Item item = inventory.get(position);
|
Item item = inventory.get(position);
|
||||||
|
if (item != null) {
|
||||||
item.clear(unit);
|
item.clear(unit);
|
||||||
inventory.remove(position);
|
inventory.remove(position);
|
||||||
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user