bugfix nullpointer in filehandler
This commit is contained in:
parent
48b3db534d
commit
891584611c
@ -6,7 +6,7 @@ plugins {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
|
||||
group 'com.actualplayer'
|
||||
version '1.2.2'
|
||||
version '1.2.3'
|
||||
description 'A way for the user to login to the server he last connected to.'
|
||||
|
||||
repositories {
|
||||
|
@ -30,13 +30,13 @@ public class FileHandler implements IRememberMeHandler {
|
||||
File userFile = FileUtils.getOrCreate(rememberMe.getDataFolderPath().resolve("data"), uuid.toString() + ".yml");
|
||||
UserServer userServer = YamlUtils.readFile(userFile, UserServer.class);
|
||||
|
||||
if(userServer == null) return null;
|
||||
|
||||
Optional<RegisteredServer> serverOpt = rememberMe.getServer().getServer(userServer.getServer());
|
||||
|
||||
CompletableFuture<String> future = new CompletableFuture<>();
|
||||
future.complete(serverOpt.map(registeredServer -> registeredServer.getServerInfo().getName()).orElse(null));
|
||||
|
||||
if(userServer == null) {
|
||||
future.complete(null);
|
||||
} else {
|
||||
Optional<RegisteredServer> serverOpt = rememberMe.getServer().getServer(userServer.getServer());
|
||||
future.complete(serverOpt.map(registeredServer -> registeredServer.getServerInfo().getName()).orElse(null));
|
||||
}
|
||||
return future;
|
||||
} catch (IOException ex) {
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user