diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-06-24 17:17:59 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-06-24 17:17:59 +0000 |
commit | 024ef0c621c6353bac7346f3ae9e457cc1fd4463 (patch) | |
tree | ab615aa552f5e978701044bc4bb64dabc0857fcb /src/modules.cpp | |
parent | 20b31c2b688086abf5891879d73f0c6194f52392 (diff) |
Module priority 'shuffler' fix from Phoenix, bounds checks
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9934 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules.cpp')
-rw-r--r-- | src/modules.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/modules.cpp b/src/modules.cpp index 9c608cb82..57790cd1b 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -335,10 +335,17 @@ bool ModuleManager::SetPriority(Module* mod, Implementation i, PriorityState s, { /* Suggestion from Phoenix, "shuffle" the modules to better retain call order */ int incrmnt = 1; + if (source > swap_pos) incrmnt = -1; + for (unsigned int j = source; j != swap_pos; j += incrmnt) + { + if (( j + incrmnt > EventHandlers[i].size() - 1) || (j - incrmnt < 0)) + continue; + std::swap(EventHandlers[i][j], EventHandlers[i][j+incrmnt]); + } } return true; |