summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-03-15 22:02:44 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-03-16 18:54:40 +0100
commit9c23fb8aca08b49aae6fc3a3ec710bf2686019ef (patch)
treeca3e64a1db1a2fca18fb6727f242e01718669b52 /src
parent6ba4653e1c0e7ee2315f57d0bb1363ab03db4496 (diff)
downloadmanaserv-9c23fb8aca08b49aae6fc3a3ec710bf2686019ef.tar.gz
manaserv-9c23fb8aca08b49aae6fc3a3ec710bf2686019ef.tar.bz2
manaserv-9c23fb8aca08b49aae6fc3a3ec710bf2686019ef.tar.xz
manaserv-9c23fb8aca08b49aae6fc3a3ec710bf2686019ef.zip
Fixed fastRemoveOne when the element isn't found
For a non-empty vectors that did not contain the element to remove, the loop would go on forever because a size_t can't become smaller than 0. Fixed by simply iterating forwards.
Diffstat (limited to 'src')
-rw-r--r--src/scripting/script.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/scripting/script.cpp b/src/scripting/script.cpp
index 074546ef..3e299461 100644
--- a/src/scripting/script.cpp
+++ b/src/scripting/script.cpp
@@ -141,7 +141,7 @@ void Script::loadNPC(const std::string &name,
template<typename T>
static void fastRemoveOne(std::vector<T> &vector, T value)
{
- for (size_t i = vector.size() - 1; i >= 0; --i)
+ for (size_t i = 0, size = vector.size(); i < size; ++i)
{
if (vector.at(i) == value)
{