Make MFC client and getOnlineModels more robust

This commit is contained in:
0xb00bface 2020-07-18 19:30:24 +02:00
parent 010c4a04cd
commit 882742ce3b
2 changed files with 4 additions and 3 deletions

View File

@ -555,11 +555,11 @@ public class NextGenLocalRecorder implements Recorder {
return getModels().stream().filter(m -> {
try {
return m.isOnline();
} catch (IOException | ExecutionException e) {
return false;
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return false;
} catch (Exception e) {
return false;
}
}).collect(Collectors.toList());
}

View File

@ -8,6 +8,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import org.json.JSONArray;
import org.json.JSONObject;
@ -86,7 +87,7 @@ public class ServerConfig {
}
public boolean isOnWzObsVideoServer(SessionState state) {
int camserv = Objects.requireNonNull(Objects.requireNonNull(state.getU()).getCamserv());
int camserv = Optional.ofNullable(state).map(SessionState::getU).map(User::getCamserv).orElse(-1);
return wzobsServers.containsKey(Integer.toString(camserv));
}