Moving the DisplayDollItemSync hook inside null check.

In crafted (hacked) packet sending, people could send the DisplayDollItemSync packet with an entity ID that is not actually a display doll. This would not happen in a normal scenario.
If they send the crafted packet, our hook would have been invoked and it would have contain a null TEDisplayDoll object since we tried to get the TileEntity object as a TEDisplayDoll object.
This commit is contained in:
Patrikkk 2020-06-21 15:03:08 +02:00
parent 10a9ee399a
commit 90dd61e668

View file

@ -3797,11 +3797,10 @@ namespace TShockAPI
if (oldItem.type == 0 && newItem.type == 0)
return false;
if (OnDisplayDollItemSync(args.Player, args.Data, playerIndex, tileEntityID, displayDoll, slot, isDye, oldItem, newItem))
return true;
}
if (OnDisplayDollItemSync(args.Player, args.Data, playerIndex, tileEntityID, displayDoll, slot, isDye, oldItem, newItem))
return true;
return false;
}