mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-21 11:55:43 +02:00
Clamp hotbar selection to slots that exist (#14869)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user