mirror of
https://github.com/Anime-Game-Servers/AGSLunarCore.git
synced 2024-11-23 04:19:48 +00:00
Fix null pointer exception that occurs when certain items are added
This commit is contained in:
parent
d82cfd4586
commit
4a291cb936
@ -19,7 +19,7 @@ public enum ItemMainType {
|
||||
private InventoryTabType tabType;
|
||||
|
||||
private ItemMainType(int value) {
|
||||
this.val = value;
|
||||
this(value, InventoryTabType.NONE);
|
||||
}
|
||||
|
||||
private ItemMainType(int value, InventoryTabType tabType) {
|
||||
|
@ -62,7 +62,10 @@ public class Inventory extends BasePlayerManager {
|
||||
}
|
||||
|
||||
public InventoryTab getTab(InventoryTabType type) {
|
||||
if (type == null) return null;
|
||||
if (type == null || type == InventoryTabType.NONE) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.inventoryTypes.get(type.getVal());
|
||||
}
|
||||
|
||||
|
@ -103,6 +103,9 @@ public class PacketPlayerSyncScNotify extends BasePacket {
|
||||
|
||||
private void addItemToProto(PlayerSyncScNotify data, GameItem item) {
|
||||
switch (item.getExcel().getItemMainType().getTabType()) {
|
||||
case MATERIAL -> {
|
||||
data.addMaterialList(item.toMaterialProto());
|
||||
}
|
||||
case RELIC -> {
|
||||
if (item.getCount() > 0) {
|
||||
data.addRelicList(item.toRelicProto());
|
||||
@ -118,7 +121,7 @@ public class PacketPlayerSyncScNotify extends BasePacket {
|
||||
}
|
||||
}
|
||||
default -> {
|
||||
data.addMaterialList(item.toMaterialProto());
|
||||
// Skip
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user