refactor: PVS-Studio warnings fixes

This commit is contained in:
MihailRis
2024-08-04 01:30:52 +03:00
parent 245b39be62
commit 47db626145
14 changed files with 81 additions and 69 deletions
+2 -2
View File
@@ -26,8 +26,8 @@ bool ItemStack::accepts(const ItemStack& other) const {
}
void ItemStack::move(ItemStack& item, const ContentIndices* indices) {
auto def = indices->items.get(item.getItemId()); //FIXME: Potentional null pointer
int count = std::min(item.count, def->stackSize - this->count); //-V522
auto& def = indices->items.require(item.getItemId());
int count = std::min(item.count, def.stackSize - this->count);
if (isEmpty()) {
set(ItemStack(item.getItemId(), count));
} else {