From e37cad714c77b24e4421f5dc1b3d01fe685b637a Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Fri, 16 Jan 2015 10:47:01 +0100 Subject: 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. --- src/FbTk/Container.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/FbTk/Container.cc b/src/FbTk/Container.cc index 9ccae92..99afb75 100644 --- a/src/FbTk/Container.cc +++ b/src/FbTk/Container.cc @@ -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(); -- cgit v0.11.2