fix crash when no account selected

Change-Id: I5ac1e2a4beddbd4476df6f60047790097cd1a5e5
Reviewed-by: Nicolas Jäger <nicolas.jager@savoirfairelinux.com>
diff --git a/src/ringmainwindow.cpp b/src/ringmainwindow.cpp
index e831d1b..7861b40 100644
--- a/src/ringmainwindow.cpp
+++ b/src/ringmainwindow.cpp
@@ -779,13 +779,15 @@
         // TODO select first conversation?
         new_view = widgets->welcome_view;
 
-        // refresh the tabs
-        auto hasPendingRequests = accountContainer_->info.contactModel->hasPendingRequests();
+        if (accountContainer_) {
+            // refresh the tabs
+            auto hasPendingRequests = accountContainer_->info.contactModel->hasPendingRequests();
 
-        gtk_notebook_set_show_tabs(GTK_NOTEBOOK(widgets->notebook_contacts), hasPendingRequests);
+            gtk_notebook_set_show_tabs(GTK_NOTEBOOK(widgets->notebook_contacts), hasPendingRequests);
 
-        if (not hasPendingRequests) {
-            gtk_notebook_prev_page(GTK_NOTEBOOK(widgets->notebook_contacts));
+            if (not hasPendingRequests) {
+                gtk_notebook_prev_page(GTK_NOTEBOOK(widgets->notebook_contacts));
+            }
         }
     }