Skip to content
Snippets Groups Projects
Commit 8b622bc5 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

account edition: fix crash if account is not found

Change-Id: I54079635496475073c1efaf54afc42aee962d03d
parent 7ef0e9e6
Branches
Tags
No related merge requests found
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* Copyright (C) 2004-2018 Savoir-faire Linux Inc. * Copyright (C) 2004-2018 Savoir-faire Linux Inc.
* *
* Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com> * Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
* Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -18,8 +19,6 @@ ...@@ -18,8 +19,6 @@
*/ */
package cx.ring.account; package cx.ring.account;
import android.view.View;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
...@@ -29,29 +28,25 @@ import cx.ring.services.AccountService; ...@@ -29,29 +28,25 @@ import cx.ring.services.AccountService;
import io.reactivex.Scheduler; import io.reactivex.Scheduler;
public class AccountEditionPresenter extends RootPresenter<AccountEditionView> { public class AccountEditionPresenter extends RootPresenter<AccountEditionView> {
private final AccountService mAccountService;
private static final String TAG = RingAccountSummaryPresenter.class.getSimpleName(); private final Scheduler mUiScheduler;
protected AccountService mAccountService;
private Account mAccount; private Account mAccount;
@Inject
@Named("UiScheduler")
protected Scheduler mUiScheduler;
@Inject @Inject
public AccountEditionPresenter(AccountService accountService) { public AccountEditionPresenter(AccountService accountService, @Named("UiScheduler") Scheduler uiScheduler) {
mAccountService = accountService; mAccountService = accountService;
mUiScheduler = uiScheduler;
} }
public void init(String accountId) { public void init(String accountId) {
final AccountEditionView view = getView(); final AccountEditionView view = getView();
if (accountId == null) { mAccount = accountId == null ? null : mAccountService.getAccount(accountId);
if (mAccount == null) {
if (view != null) if (view != null)
view.exit(); view.exit();
return; return;
} }
mAccount = mAccountService.getAccount(accountId);
view.displayAccountName(mAccount.getAlias()); view.displayAccountName(mAccount.getAlias());
if (mAccount.isRing()) { if (mAccount.isRing()) {
view.displaySummary(mAccount.getAccountID()); view.displaySummary(mAccount.getAccountID());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment