From a484ee817cb1ee1daad9341d90d9b36fc0ada7d5 Mon Sep 17 00:00:00 2001
From: Thomas Tanghus <thomas@tanghus.net>
Date: Thu, 2 Aug 2012 18:50:20 +0200
Subject: [PATCH] If first addressbook was empty it was seen as if there where
 no contacts at all.

---
 apps/contacts/js/contacts.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js
index 01301e0d53..a708352cba 100644
--- a/apps/contacts/js/contacts.js
+++ b/apps/contacts/js/contacts.js
@@ -316,8 +316,11 @@ OC.Contacts={
 			console.log('Card, cid: ' + params.cid + ' aid: ' + params.aid);
 			var newid, bookid, firstitem;
 			if(!parseInt(params.cid) && !parseInt(params.aid)) {
-				firstitem = $('#contacts ul').first().find('li:first-child');
+				firstitem = $('#contacts ul').find('li:first-child');
 				if(firstitem.length > 0) {
+					if(firstitem.length > 1) {
+						firstitem = firstitem.first();
+					}
 					newid = parseInt(firstitem.data('id'));
 					bookid = parseInt(firstitem.data('bookid'));
 				}
-- 
GitLab