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