diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp index 0e662b282..8b6c78838 100644 --- a/src/gui/guiFormSpecMenu.cpp +++ b/src/gui/guiFormSpecMenu.cpp @@ -4447,6 +4447,12 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event) if (m_left_drag_stacks.size() > 1) { // Finalize the left-dragging for (auto &ds : m_left_drag_stacks) { + if (ds.first == *m_selected_item) { + // This entry is needed to properly calculate the stack sizes. + // The stack already exists, hence no further action needed here. + continue; + } + // Check how many items we should move to this slot, // it may be less than the full split Inventory *inv_to = m_invmgr->getInventory(ds.first.inventoryloc); diff --git a/src/gui/guiInventoryList.h b/src/gui/guiInventoryList.h index 07ca93c3f..8ef63c8bc 100644 --- a/src/gui/guiInventoryList.h +++ b/src/gui/guiInventoryList.h @@ -43,7 +43,7 @@ public: { } - bool operator==(const ItemSpec& other) + bool operator==(const ItemSpec& other) const { return inventoryloc == other.inventoryloc && listname == other.listname && i == other.i;