From 5828d57277a37ee78a162ac9dff142e7a8d30c60 Mon Sep 17 00:00:00 2001 From: nowrep Date: Thu, 26 Dec 2013 19:52:07 +0100 Subject: [PATCH] [TabBar] Fixed crash in tabSizeHint (division by zero). --- src/lib/tools/combotabbar.cpp | 4 ++-- src/lib/webview/tabbar.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/tools/combotabbar.cpp b/src/lib/tools/combotabbar.cpp index f8ad9e8e3..c2cf73e7b 100644 --- a/src/lib/tools/combotabbar.cpp +++ b/src/lib/tools/combotabbar.cpp @@ -479,8 +479,8 @@ void ComboTabBar::setUpLayout() { int height = qMax(m_mainTabBar->height(), m_pinnedTabBar->height()); - // Workaround for Oxygen theme. For some reason, m_mainTabBar->height() returns bigger - // height than it actually is. + // Workaround for Oxygen theme. For some reason, QTabBar::height() returns bigger + // height than it actually should. if (mApp->proxyStyle() && mApp->proxyStyle()->name() == QLatin1String("oxygen")) { height -= 4; } diff --git a/src/lib/webview/tabbar.cpp b/src/lib/webview/tabbar.cpp index 4c3caf9d7..3df9be9f7 100644 --- a/src/lib/webview/tabbar.cpp +++ b/src/lib/webview/tabbar.cpp @@ -255,13 +255,13 @@ QSize TabBar::tabSizeHint(int index, bool fast) const m_normalTabWidth = MAXIMUM_TAB_WIDTH; size.setWidth(m_normalTabWidth); } - else { + else if (normalTabsCount > 0) { int maxWidthForTab = availableWidth / normalTabsCount; int realTabWidth = maxWidthForTab; bool adjustingActiveTab = false; if (realTabWidth < MINIMUM_ACTIVE_TAB_WIDTH) { - maxWidthForTab = (availableWidth - MINIMUM_ACTIVE_TAB_WIDTH) / (normalTabsCount - 1); + maxWidthForTab = normalTabsCount > 1 ? (availableWidth - MINIMUM_ACTIVE_TAB_WIDTH) / (normalTabsCount - 1) : 0; realTabWidth = MINIMUM_ACTIVE_TAB_WIDTH; adjustingActiveTab = true; }