Fixed NPE if player does not have adena after buying lottery ticket.

Contributed by Sahar.
This commit is contained in:
MobiusDevelopment 2021-08-21 23:29:47 +00:00
parent 67dde47233
commit 1c553b962c
2 changed files with 8 additions and 2 deletions

View File

@ -235,7 +235,10 @@ public class Loto implements IBypassHandler
final InventoryUpdate iu = new InventoryUpdate(); final InventoryUpdate iu = new InventoryUpdate();
iu.addItem(item); iu.addItem(item);
final ItemInstance adenaupdate = player.getInventory().getItemByItemId(57); final ItemInstance adenaupdate = player.getInventory().getItemByItemId(57);
iu.addModifiedItem(adenaupdate); if (adenaupdate != null)
{
iu.addModifiedItem(adenaupdate);
}
player.sendPacket(iu); player.sendPacket(iu);
filename = (npc.getHtmlPath(npcId, 6)); filename = (npc.getHtmlPath(npcId, 6));

View File

@ -235,7 +235,10 @@ public class Loto implements IBypassHandler
final InventoryUpdate iu = new InventoryUpdate(); final InventoryUpdate iu = new InventoryUpdate();
iu.addItem(item); iu.addItem(item);
final ItemInstance adenaupdate = player.getInventory().getItemByItemId(57); final ItemInstance adenaupdate = player.getInventory().getItemByItemId(57);
iu.addModifiedItem(adenaupdate); if (adenaupdate != null)
{
iu.addModifiedItem(adenaupdate);
}
player.sendPacket(iu); player.sendPacket(iu);
filename = (npc.getHtmlPath(npcId, 6)); filename = (npc.getHtmlPath(npcId, 6));