diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2016-11-27 17:08:58 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2017-01-21 14:51:31 +0100 |
commit | 9ec1bcd8d497eb20aea4a4ba89c4816051bc5040 (patch) | |
tree | f730c734502272736897f9ece2c621559fdce825 /plugingui | |
parent | 702955faa5bd42633e7d815a1fa118b26ecfd031 (diff) |
Prevent division by zero.
Diffstat (limited to 'plugingui')
-rw-r--r-- | plugingui/tabwidget.cc | 7 |
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); |