mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 09:01:08 +03:00
[FIX] Несколько фиксов NPE
This commit is contained in:
parent
aa87ff05eb
commit
2c8c640130
3 changed files with 11 additions and 6 deletions
|
@ -21,6 +21,7 @@ public void execute(ChannelHandlerContext ctx, Client client) {
|
||||||
Client rClient = server.sessionManager.getClient(session);
|
Client rClient = server.sessionManager.getClient(session);
|
||||||
if (rClient == null) {
|
if (rClient == null) {
|
||||||
sendError("Session invalid");
|
sendError("Session invalid");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
WebSocketFrameHandler frameHandler = ctx.pipeline().get(WebSocketFrameHandler.class);
|
WebSocketFrameHandler frameHandler = ctx.pipeline().get(WebSocketFrameHandler.class);
|
||||||
frameHandler.setClient(rClient);
|
frameHandler.setClient(rClient);
|
||||||
|
|
|
@ -50,7 +50,6 @@ public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||||
String username;
|
String username;
|
||||||
AuthProviderPair pair;
|
AuthProviderPair pair;
|
||||||
if (client.auth == null) {
|
if (client.auth == null) {
|
||||||
LogHelper.warning("Client auth is null. Using default.");
|
|
||||||
pair = server.config.getAuthProviderPair();
|
pair = server.config.getAuthProviderPair();
|
||||||
} else {
|
} else {
|
||||||
pair = client.auth;
|
pair = client.auth;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
import pro.gravit.launcher.events.request.ProfileByUsernameRequestEvent;
|
import pro.gravit.launcher.events.request.ProfileByUsernameRequestEvent;
|
||||||
import pro.gravit.launchserver.socket.Client;
|
import pro.gravit.launchserver.socket.Client;
|
||||||
import pro.gravit.launchserver.socket.response.SimpleResponse;
|
import pro.gravit.launchserver.socket.response.SimpleResponse;
|
||||||
|
import pro.gravit.launchserver.auth.AuthProviderPair;
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -20,10 +21,14 @@ public String getType() {
|
||||||
@Override
|
@Override
|
||||||
public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||||
UUID uuid;
|
UUID uuid;
|
||||||
if (client.auth == null) {
|
AuthProviderPair pair = client.auth;
|
||||||
LogHelper.warning("Client auth is null. Using default.");
|
if(pair == null) pair = server.config.getAuthProviderPair();
|
||||||
uuid = server.config.getAuthProviderPair().handler.usernameToUUID(username);
|
uuid = pair.handler.usernameToUUID(username);
|
||||||
} else uuid = client.auth.handler.usernameToUUID(username);
|
if(uuid == null)
|
||||||
sendResult(new ProfileByUsernameRequestEvent(ProfileByUUIDResponse.getProfile(uuid, username, this.client, client.auth.textureProvider)));
|
{
|
||||||
|
sendError("User not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sendResult(new ProfileByUsernameRequestEvent(ProfileByUUIDResponse.getProfile(uuid, username, this.client, pair.textureProvider)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue