summaryrefslogtreecommitdiff
path: root/plugingui/tabwidget.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2016-11-27 17:08:58 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2017-01-21 14:51:31 +0100
commit9ec1bcd8d497eb20aea4a4ba89c4816051bc5040 (patch)
treef730c734502272736897f9ece2c621559fdce825 /plugingui/tabwidget.cc
parent702955faa5bd42633e7d815a1fa118b26ecfd031 (diff)
Prevent division by zero.
Diffstat (limited to 'plugingui/tabwidget.cc')
-rw-r--r--plugingui/tabwidget.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugingui/tabwidget.cc b/plugingui/tabwidget.cc
index 6988d39..10dd996 100644
--- a/plugingui/tabwidget.cc
+++ b/plugingui/tabwidget.cc
@@ -54,7 +54,12 @@ void TabWidget::switchTab(Widget* tabWidget)
void TabWidget::sizeChanged(int width, int height)
{
std::size_t pos = 0;
- std::size_t buttonWidth = width / buttons.size();
+ std::size_t buttonWidth = 1;
+ if(buttons.size() > 0)
+ {
+ buttonWidth = width / buttons.size();
+ }
+
for(auto& button : buttons)
{
button.resize(buttonWidth, 40);