diff --git a/common/src/main/java/ctbrec/recorder/download/hls/MergedFfmpegHlsDownload.java b/common/src/main/java/ctbrec/recorder/download/hls/MergedFfmpegHlsDownload.java index 50df4f0e..e242f82e 100644 --- a/common/src/main/java/ctbrec/recorder/download/hls/MergedFfmpegHlsDownload.java +++ b/common/src/main/java/ctbrec/recorder/download/hls/MergedFfmpegHlsDownload.java @@ -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(); } }