From 091126e2e26e5ab6187998726d06afec089a5874 Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Sat, 19 Mar 2016 23:08:05 +0000 Subject: [PATCH] Added conditions to prevent breaking if no callback interface is defined. --- src/main/java/musicplayer/player/GStreamerPlayer.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/musicplayer/player/GStreamerPlayer.java b/src/main/java/musicplayer/player/GStreamerPlayer.java index e4b206c..c2ed7c6 100644 --- a/src/main/java/musicplayer/player/GStreamerPlayer.java +++ b/src/main/java/musicplayer/player/GStreamerPlayer.java @@ -67,7 +67,8 @@ public class GStreamerPlayer implements IPlayer{ } private void resetSeek(){ - callbackInterface.setSeekBarPosition(0); + if(callbackInterface != null) + callbackInterface.setSeekBarPosition(0); } public void play() throws StartPlayingException { @@ -106,7 +107,8 @@ public class GStreamerPlayer implements IPlayer{ while (true) { if (playBin.queryDuration().getSeconds() > 0 || playBin.queryDuration().getNanoSeconds() > 0) break; } // Wait for song to actually be playing otherwise queryDuration is always zero - callbackInterface.setSeekBarDuration((int) playBin.queryDuration().toSeconds()); + if(callbackInterface != null) + callbackInterface.setSeekBarDuration((int) playBin.queryDuration().toSeconds()); } else{ throw new StartPlayingException(inputSong.get());