Commit ccb9d427 authored by Anthony Léonard's avatar Anthony Léonard Committed by Olivier SOLDANO

fix account selection on fresh install

Fix bug where, at first user creation, Ring was crashing at the end of
the wizard just before displaying the main user interface. This was
caused by a preference string set to nil on first start.

Now, when to string is nil, we select the first account of the list as
this should happen only at first account creation (thus returning the
right one).

Change-Id: Id3a2c4153d920611a3cc0cbd694f8d96d772330a
Reviewed-by: default avatarOlivier Soldano <>
parent f3c9ede5
......@@ -50,7 +50,13 @@ NSString* const savedUserAccountKey = @"savedUserSelectedAccountKey";
- (const lrc::api::account::Info&) savedAccount
return accMdl_->getAccountInfo(std::string([[self getSavedAccountId] UTF8String]));
NSString* savedAccountId = [self getSavedAccountId];
if (savedAccountId == nil) {
auto accId = accMdl_->getAccountList().front();
[self saveAccountWithId:@(accId.c_str())];
return accMdl_->getAccountInfo(accId);
} else
return accMdl_->getAccountInfo(std::string([savedAccountId UTF8String]));
- (void) setSavedAccount:(const lrc::api::account::Info&) acc
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment