From bed742cc44107892be4a246037a6216058a4cc56 Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Fri, 20 Aug 2010 10:48:13 +0100
Subject: Don't crash when .app is 'open'ed on a Mac.

Resolves: #534

diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index 3a56637..ef02096 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -66,7 +66,13 @@ QtSwift::QtSwift(po::variables_map options) : autoUpdater_(NULL) {
 	QCoreApplication::setOrganizationDomain(SWIFT_ORGANIZATION_DOMAIN);
 	QCoreApplication::setApplicationVersion(buildVersion);
 
-	int numberOfAccounts = options["multi-account"].as<int>();
+	int numberOfAccounts = 1;
+	try {
+		numberOfAccounts = options["multi-account"].as<int>();
+	} catch (...) {
+		/* This seems to fail on a Mac when the .app is launched directly (the usual path).*/
+		numberOfAccounts = 1;
+	}
 
 	tabs_ = options.count("no-tabs") && !(splitter_ > 0) ? NULL : new QtChatTabs();
 	settings_ = new QtSettingsProvider();
-- 
cgit v0.10.2-6-g49f6