null safety on auth/handshake errors

This commit is contained in:
Blue Kelp 2019-08-02 13:54:40 -07:00
parent f62aa390d2
commit 5f93b5bec4
2 changed files with 12 additions and 5 deletions

View file

@ -158,10 +158,14 @@ public class GeyserSession implements PlayerSession, Player {
public void disconnect(String reason) { public void disconnect(String reason) {
if (!closed) { if (!closed) {
loggedIn = false; loggedIn = false;
if (downstream != null && downstream.getSession() != null) {
downstream.getSession().disconnect(reason); downstream.getSession().disconnect(reason);
}
if (upstream != null) {
upstream.disconnect(reason); upstream.disconnect(reason);
} }
} }
}
@Override @Override
public boolean isClosed() { public boolean isClosed() {

View file

@ -150,10 +150,13 @@ public class LoginEncryptionUtils {
return false; return false;
CustomFormResponse response = (CustomFormResponse) customFormWindow.getResponse(); CustomFormResponse response = (CustomFormResponse) customFormWindow.getResponse();
if (response != null) {
String email = response.getInputResponses().get(2); String email = response.getInputResponses().get(2);
String password = response.getInputResponses().get(3); String password = response.getInputResponses().get(3);
session.authenticate(email, password); session.authenticate(email, password);
}
// TODO should we clear the window cache in all cases or just if not already logged in? // TODO should we clear the window cache in all cases or just if not already logged in?
// Clear windows so authentication data isn't accidentally cached // Clear windows so authentication data isn't accidentally cached