Fixed NPE when trying to publish non-existent item.

Contributed by Sahar.
This commit is contained in:
MobiusDevelopment
2019-10-14 19:49:13 +00:00
parent 6d55443589
commit 125cb621b1

View File

@@ -247,7 +247,7 @@ public class Say2 implements IClientIncomingPacket
} }
final int id = Integer.parseInt(result.toString()); final int id = Integer.parseInt(result.toString());
final WorldObject item = World.getInstance().findObject(id); final WorldObject item = World.getInstance().findObject(id);
if (item.isItem()) if (item instanceof ItemInstance)
{ {
if (owner.getInventory().getItemByObjectId(id) == null) if (owner.getInventory().getItemByObjectId(id) == null)
{ {
@@ -258,7 +258,6 @@ public class Say2 implements IClientIncomingPacket
} }
else else
{ {
LOGGER.info(owner.getClient() + " trying publish object which is not item! Object:" + item);
return false; return false;
} }
pos1 = _text.indexOf(8, pos) + 1; pos1 = _text.indexOf(8, pos) + 1;