[libbluray-devel] Check for null

hpi1 git at videolan.org
Mon May 2 10:51:07 CEST 2016


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Mon May  2 11:36:18 2016 +0300| [674205a8232fd4f77205fde14410fa0575ecb97d] | committer: hpi1

Check for null

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=674205a8232fd4f77205fde14410fa0575ecb97d
---

 .../bdj/java/org/videolan/media/content/playlist/Handler.java   |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/Handler.java b/src/libbluray/bdj/java/org/videolan/media/content/playlist/Handler.java
index dd5f07c..fa8526e 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/Handler.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/playlist/Handler.java
@@ -125,8 +125,11 @@ public class Handler extends BDHandler {
     }
 
     public Time getDuration() {
-        long duration = pi.getDuration() ;
-        return new Time(duration * TO_SECONDS);
+        if (pi != null) {
+            long duration = pi.getDuration();
+            return new Time(duration * TO_SECONDS);
+        }
+        return DURATION_UNKNOWN;
     }
 
     protected ControllerErrorEvent doPrefetch() {



More information about the libbluray-devel mailing list