summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtChatTabs.cpp')
-rw-r--r--Swift/QtUI/QtChatTabs.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp
index 90be786..d3a5676 100644
--- a/Swift/QtUI/QtChatTabs.cpp
+++ b/Swift/QtUI/QtChatTabs.cpp
@@ -110,18 +110,16 @@ void QtChatTabs::handleWantsToActivate() {
void QtChatTabs::handleTabClosing() {
QWidget* widget = qobject_cast<QWidget*>(sender());
- if (!widget) {
- return;
- }
- int index = tabs_->indexOf(widget);
- if (index < 0) {
- return;
- }
- tabs_->removeTab(index);
- if (tabs_->count() == 0) {
- hide();
+ int index;
+ if (widget && ((index = tabs_->indexOf(widget)) >= 0)) {
+ tabs_->removeTab(index);
+ if (tabs_->count() == 0) {
+ hide();
+ }
+ else {
+ handleTabTitleUpdated(tabs_->currentWidget());
+ }
}
- handleTabTitleUpdated(tabs_->currentWidget());
}
void QtChatTabs::handleRequestedPreviousTab() {