From e2cd419b51bc27b8c8b3e65aae679cedf3033224 Mon Sep 17 00:00:00 2001
From: Jan-Christoph Borchardt <hey@jancborchardt.net>
Date: Wed, 15 Jul 2015 21:25:29 +0200
Subject: [PATCH] fix title double dash for unified inbox, ref #803

---
 js/views/folder.js | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/js/views/folder.js b/js/views/folder.js
index 5aece3bd2..670d7d354 100644
--- a/js/views/folder.js
+++ b/js/views/folder.js
@@ -111,17 +111,21 @@ views.Folders = Backbone.Marionette.CollectionView.extend({
 	},
 
 	updateTitle: function() {
-		var activeAccount = Mail.State.currentAccountId;
-		activeAccount = this.collection.get(activeAccount);
+		var activeEmail = '';
+		if (Mail.State.currentAccountId !== -1) {
+			var activeAccount = Mail.State.currentAccountId;
+			activeAccount = this.collection.get(activeAccount);
+			activeEmail = ' - ' + activeAccount.get('email');
+		}
 		var activeFolder = this.getFolderById();
 		var unread = activeFolder.unseen;
 		var name = activeFolder.name || activeFolder.get('name');
 
 		if (unread > 0) {
-			window.document.title = name + ' (' + unread + ') - ' +
-			activeAccount.get('email') + ' - Mail - ' + oc_defaults.title;
+			window.document.title = name + ' (' + unread + ')' +
+			activeEmail + ' - Mail - ' + oc_defaults.title;
 		} else {
-			window.document.title = name + ' - ' + activeAccount.get('email') +
+			window.document.title = name + activeEmail +
 			' - Mail - ' + oc_defaults.title;
 		}
 	}
-- 
GitLab