Throw IAE when getAccountType() receives an unexpected param

This commit is contained in:
yushijinhun 2018-07-19 21:19:09 +08:00
parent 487816ab74
commit be8cd13b08
No known key found for this signature in database
GPG Key ID: 5BC167F73EA558E4

View File

@ -61,10 +61,14 @@ public final class Accounts {
); );
public static String getAccountType(Account account) { public static String getAccountType(Account account) {
if (account instanceof OfflineAccount) return OFFLINE_ACCOUNT_KEY; if (account instanceof OfflineAccount)
else if (account instanceof AuthlibInjectorAccount) return AUTHLIB_INJECTOR_ACCOUNT_KEY; return OFFLINE_ACCOUNT_KEY;
else if (account instanceof YggdrasilAccount) return YGGDRASIL_ACCOUNT_KEY; else if (account instanceof AuthlibInjectorAccount)
else return YGGDRASIL_ACCOUNT_KEY; return AUTHLIB_INJECTOR_ACCOUNT_KEY;
else if (account instanceof YggdrasilAccount)
return YGGDRASIL_ACCOUNT_KEY;
else
throw new IllegalArgumentException("Failed to determine account type: " + account);
} }
static String getAccountId(Account account) { static String getAccountId(Account account) {