mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
[FIX] AuthManager NPE
This commit is contained in:
parent
9e7dedffc9
commit
f0ae4cbb12
2 changed files with 12 additions and 0 deletions
|
@ -286,6 +286,9 @@ public void invoke(String... args) throws Exception {
|
||||||
|
|
||||||
public User checkServer(Client client, String username, String serverID) throws IOException {
|
public User checkServer(Client client, String username, String serverID) throws IOException {
|
||||||
User user = getUserByUsername(username);
|
User user = getUserByUsername(username);
|
||||||
|
if (user == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (user.getUsername().equals(username) && user.getServerId().equals(serverID)) {
|
if (user.getUsername().equals(username) && user.getServerId().equals(serverID)) {
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,6 +235,9 @@ public PlayerProfile getPlayerProfile(Client client) {
|
||||||
PlayerProfile playerProfile;
|
PlayerProfile playerProfile;
|
||||||
if (client.useOAuth) {
|
if (client.useOAuth) {
|
||||||
User user = client.getUser();
|
User user = client.getUser();
|
||||||
|
if (user == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
playerProfile = getPlayerProfile(client.auth, user);
|
playerProfile = getPlayerProfile(client.auth, user);
|
||||||
if (playerProfile != null) return playerProfile;
|
if (playerProfile != null) return playerProfile;
|
||||||
}
|
}
|
||||||
|
@ -253,6 +256,9 @@ public PlayerProfile getPlayerProfile(AuthProviderPair pair, String username, Cl
|
||||||
UUID uuid = null;
|
UUID uuid = null;
|
||||||
if (pair.isUseCore()) {
|
if (pair.isUseCore()) {
|
||||||
User user = pair.core.getUserByUsername(username);
|
User user = pair.core.getUserByUsername(username);
|
||||||
|
if (user == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
PlayerProfile playerProfile = getPlayerProfile(pair, user);
|
PlayerProfile playerProfile = getPlayerProfile(pair, user);
|
||||||
uuid = user.getUUID();
|
uuid = user.getUUID();
|
||||||
if (playerProfile != null) return playerProfile;
|
if (playerProfile != null) return playerProfile;
|
||||||
|
@ -280,6 +286,9 @@ public PlayerProfile getPlayerProfile(AuthProviderPair pair, UUID uuid, ClientPr
|
||||||
String username = null;
|
String username = null;
|
||||||
if (pair.isUseCore()) {
|
if (pair.isUseCore()) {
|
||||||
User user = pair.core.getUserByUUID(uuid);
|
User user = pair.core.getUserByUUID(uuid);
|
||||||
|
if (user == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
PlayerProfile playerProfile = getPlayerProfile(pair, user);
|
PlayerProfile playerProfile = getPlayerProfile(pair, user);
|
||||||
username = user.getUsername();
|
username = user.getUsername();
|
||||||
if (playerProfile != null) return playerProfile;
|
if (playerProfile != null) return playerProfile;
|
||||||
|
|
Loading…
Reference in a new issue