mirror of
				https://github.com/simon987/Much-Assembly-Required.git
				synced 2025-10-31 08:16:52 +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() { | ||||
|         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; | ||||
|     } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user