throw exception if no instance for session
This commit is contained in:
parent
7849c34d1f
commit
32081b71f5
|
@ -52,12 +52,6 @@ public class MainActivity extends FragmentStackActivity{
|
|||
}else{
|
||||
session=AccountSessionManager.getInstance().getLastActiveAccount();
|
||||
}
|
||||
if (session.getInstance() == null) {
|
||||
// i don't know how, but i ended up having a session, but no instance info.
|
||||
// removing account to avoid glitched behavior and crashes
|
||||
AccountSessionManager.getInstance().removeAccount(session.getID());
|
||||
session=AccountSessionManager.getInstance().getLastActiveAccount();
|
||||
}
|
||||
args.putString("account", session.getID());
|
||||
Fragment fragment=session.activated ? new HomeFragment() : new AccountActivationFragment();
|
||||
fragment.setArguments(args);
|
||||
|
|
|
@ -463,7 +463,12 @@ public class AccountSessionManager{
|
|||
}
|
||||
|
||||
public Instance getInstanceInfo(String domain){
|
||||
return instances.get(domain);
|
||||
Instance instance = instances.get(domain);
|
||||
if (instance == null) {
|
||||
throw new IllegalStateException("Cannot get instance for " + domain + ". Sessions: "
|
||||
+ String.join(", ", instances.keySet()));
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void updateAccountInfo(String id, Account account){
|
||||
|
|
Loading…
Reference in New Issue