Avoid modulo 0
Coverity pointed out that 'size' might be 0 (even if the 'find()' would detect this). This commit fixes this and avoids entering 'find()' at all.
This commit is contained in:
parent
ad8e6da8ef
commit
e37cad714c
1 changed files with 4 additions and 0 deletions
|
@ -94,6 +94,10 @@ void Container::insertItem(Item item, int pos) {
|
|||
|
||||
void Container::moveItem(Item item, int movement) {
|
||||
|
||||
if (m_item_list.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int index = find(item);
|
||||
const size_t size = m_item_list.size();
|
||||
|
||||
|
|
Loading…
Reference in a new issue