From 6385ba952548b098348f3ab1002437d516b29e5c Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Sun, 30 Sep 2012 14:39:26 +0100
Subject: Slightly neaten code


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() {
-- 
cgit v0.10.2-6-g49f6