mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-01 17:38:41 +00:00
Clamp hotbar selection to slots that exist (#14869)
This commit is contained in:
parent
39c2af9710
commit
98e51a0159
8 changed files with 51 additions and 11 deletions
|
@ -852,11 +852,11 @@ void Server::handleCommand_PlayerItem(NetworkPacket* pkt)
|
|||
|
||||
*pkt >> item;
|
||||
|
||||
if (item >= player->getHotbarItemcount()) {
|
||||
if (item >= player->getMaxHotbarItemcount()) {
|
||||
actionstream << "Player: " << player->getName()
|
||||
<< " tried to access item=" << item
|
||||
<< " out of hotbar_itemcount="
|
||||
<< player->getHotbarItemcount()
|
||||
<< player->getMaxHotbarItemcount()
|
||||
<< "; ignoring." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
@ -983,11 +983,11 @@ void Server::handleCommand_Interact(NetworkPacket *pkt)
|
|||
|
||||
// Update wielded item
|
||||
|
||||
if (item_i >= player->getHotbarItemcount()) {
|
||||
if (item_i >= player->getMaxHotbarItemcount()) {
|
||||
actionstream << "Player: " << player->getName()
|
||||
<< " tried to access item=" << item_i
|
||||
<< " out of hotbar_itemcount="
|
||||
<< player->getHotbarItemcount()
|
||||
<< player->getMaxHotbarItemcount()
|
||||
<< "; ignoring." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue