[vlc-devel] commit: libvlc: Properly raise an exception if something goes wrong in libvlc_media_get_duration and libvlc_media_is_preparsed . (Pierre d'Herbemont )

git version control git at videolan.org
Sun Aug 3 20:03:28 CEST 2008


vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Sun Aug  3 19:40:30 2008 +0200| [7aca2b195b170ae920d2dcd086a0e537bbedcd63] | committer: Pierre d'Herbemont 

libvlc: Properly raise an exception if something goes wrong in libvlc_media_get_duration and libvlc_media_is_preparsed.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7aca2b195b170ae920d2dcd086a0e537bbedcd63
---

 src/control/media.c |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/control/media.c b/src/control/media.c
index bb6e742..0647077 100644
--- a/src/control/media.c
+++ b/src/control/media.c
@@ -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 );
 }
 
 /**************************************************************************




More information about the vlc-devel mailing list