forked from j62/ctbrec
Avoid NPE in onError
This commit is contained in:
parent
5145ed0ce2
commit
47d8101ce8
|
@ -3,6 +3,7 @@ package ctbrec.ui.controls;
|
||||||
import java.io.InterruptedIOException;
|
import java.io.InterruptedIOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
@ -161,8 +162,9 @@ public class StreamPreview extends StackPane {
|
||||||
|
|
||||||
private void onError(MediaPlayer videoPlayer) {
|
private void onError(MediaPlayer videoPlayer) {
|
||||||
LOG.error("Error while starting preview stream", videoPlayer.getError());
|
LOG.error("Error while starting preview stream", videoPlayer.getError());
|
||||||
if(videoPlayer.getError().getCause() != null) {
|
Optional<Throwable> cause = Optional.ofNullable(videoPlayer).map(v -> v.getError()).map(e -> e.getCause());
|
||||||
LOG.error("Error while starting preview stream root cause:", videoPlayer.getError().getCause());
|
if(cause.isPresent()) {
|
||||||
|
LOG.error("Error while starting preview stream root cause:", cause.get());
|
||||||
}
|
}
|
||||||
showTestImage();
|
showTestImage();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue