Fix NPE in internalStop

This commit is contained in:
0xboobface 2020-05-10 10:43:37 +02:00
parent cd5172613e
commit 3c4ef05a48
1 changed files with 11 additions and 9 deletions

View File

@ -358,16 +358,18 @@ public class MergedFfmpegHlsDownload extends AbstractHlsDownload {
}
}
try {
boolean waitFor = ffmpeg.waitFor(5, TimeUnit.MINUTES);
if (!waitFor && ffmpeg.isAlive()) {
LOG.info("FFmpeg didn't terminate. Destroying the process with force!");
ffmpeg.destroyForcibly();
ffmpeg = null;
if (ffmpeg != null) {
try {
boolean waitFor = ffmpeg.waitFor(5, TimeUnit.MINUTES);
if (!waitFor && ffmpeg.isAlive()) {
LOG.info("FFmpeg didn't terminate. Destroying the process with force!");
ffmpeg.destroyForcibly();
ffmpeg = null;
}
} catch (InterruptedException e) {
LOG.error("Interrupted while waiting for FFmpeg to terminate");
Thread.currentThread().interrupt();
}
} catch (InterruptedException e) {
LOG.error("Interrupted while waiting for FFmpeg to terminate");
Thread.currentThread().interrupt();
}
}