From 8fdee7950531edd8c452f7c0dc4e689dd0446cbe Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Wed, 20 Aug 2014 16:06:16 +0200 Subject: [PATCH] Fix crash in accountsettings --- src/mirall/accountsettings.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mirall/accountsettings.cpp b/src/mirall/accountsettings.cpp index 9f8b84fe2e..2bdafd6509 100644 --- a/src/mirall/accountsettings.cpp +++ b/src/mirall/accountsettings.cpp @@ -235,7 +235,11 @@ void AccountSettings::slotAddFolder( Folder *folder ) if( ! folder || folder->alias().isEmpty() ) return; QStandardItem *item = new QStandardItem(); - folderToModelItem( item, folder, _account->state() == Account::Connected ); + bool isConnected = false; + if (_account) { + isConnected = (_account->state() == Account::Connected); + } + folderToModelItem( item, folder, isConnected); _model->appendRow( item ); // in order to update the enabled state of the "Sync now" button connect(folder, SIGNAL(syncStateChange()), this, SLOT(slotFolderSyncStateChange()), Qt::UniqueConnection); @@ -273,7 +277,7 @@ void AccountSettings::folderToModelItem( QStandardItem *item, Folder *f, bool ac Theme *theme = Theme::instance(); item->setData( theme->statusHeaderText( status ), Qt::ToolTipRole ); - if (_account->state() == Account::Connected) { + if ( accountConnected ) { if( f->syncPaused() ) { item->setData( theme->folderDisabledIcon( ), FolderStatusDelegate::FolderStatusIconRole ); // size 48 before _wasDisabledBefore = false;