Fix console froze if inventory do not exist

issues #908
This commit is contained in:
ReinforceZwei 2020-03-30 22:29:12 +08:00 committed by ORelio
parent c581ac95c3
commit 0b31f70d7b

View file

@ -32,6 +32,8 @@ namespace MinecraftClient.Commands
else return "Failed to close Inventory #" + inventoryId;
case "list":
Container inventory = handler.GetInventory(inventoryId);
if(inventory==null)
return "Inventory #" + inventoryId + " do not exist";
List<string> response = new List<string>();
response.Add("Inventory #" + inventoryId + " - " + inventory.Title + "§8");
foreach (KeyValuePair<int, Item> item in inventory.Items)