diff --git a/core/logic/CDataPack.cpp b/core/logic/CDataPack.cpp index 79b88b32..5f09ef21 100644 --- a/core/logic/CDataPack.cpp +++ b/core/logic/CDataPack.cpp @@ -219,12 +219,16 @@ bool CDataPack::RemoveItem(size_t pos) { pos = position; } - if (pos >= elements.length()) { return false; } + if (pos < position) // we're deleting under us, step back + { + --position; + } + switch (elements[pos].type) { case CDataPackType::Raw: @@ -241,6 +245,5 @@ bool CDataPack::RemoveItem(size_t pos) } elements.remove(pos); - --position; return true; }