]> git.sesse.net Git - vlc/commitdiff
libvlc: Properly raise an exception if something goes wrong in libvlc_media_get_durat...
authorPierre d'Herbemont <pdherbemont@videolan.org>
Sun, 3 Aug 2008 17:40:30 +0000 (19:40 +0200)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Sun, 3 Aug 2008 18:06:05 +0000 (20:06 +0200)
src/control/media.c

index bb6e7420d67b39206cfa3e57796aa3e7db556522..064707799c7f0e0702d1f70244a73829ee6491da 100644 (file)
@@ -519,14 +519,13 @@ libvlc_media_get_duration( libvlc_media_t * p_md,
 {
     VLC_UNUSED(p_e);
 
-    if( p_md && p_md->p_input_item)
-    {
-        return input_item_GetDuration( p_md->p_input_item );
-    }
-    else
+    if( !p_md || !p_md->p_input_item)
     {
+        libvlc_exception_raise( p_e, "No input item" );
         return -1;
     }
+
+    return input_item_GetDuration( p_md->p_input_item );
 }
 
 /**************************************************************************
@@ -538,14 +537,13 @@ libvlc_media_is_preparsed( libvlc_media_t * p_md,
 {
     VLC_UNUSED(p_e);
 
-    if( p_md && p_md->p_input_item)
-    {
-        return input_item_IsPreparsed( p_md->p_input_item );
-    }
-    else
+    if( !p_md || !p_md->p_input_item)
     {
+        libvlc_exception_raise( p_e, "No input item" );
         return false;
     }
+
+    return input_item_IsPreparsed( p_md->p_input_item );
 }
 
 /**************************************************************************