forked from j62/ctbrec
1
0
Fork 0

Fix possible NPE in update

This commit is contained in:
0xboobface 2018-11-24 15:16:51 +01:00
parent 85fee70e60
commit edb11a0efc
1 changed files with 2 additions and 1 deletions

View File

@ -219,9 +219,10 @@ public class MyFreeCamsModel extends AbstractModel {
public void update(SessionState state, String streamUrl) {
uid = Integer.parseInt(state.getUid().toString());
setName(state.getNm());
setCamScore(state.getM().getCamscore());
setState(State.of(state.getVs()));
setStreamUrl(streamUrl);
Optional<Double> camScore = Optional.of(state.getM()).map(m -> m.getCamscore());
setCamScore(camScore.orElse(0.0));
// preview
String uid = state.getUid().toString();