From 9ec1bcd8d497eb20aea4a4ba89c4816051bc5040 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 27 Nov 2016 17:08:58 +0100 Subject: Prevent division by zero. --- plugingui/tabwidget.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'plugingui') 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); -- cgit v1.2.3