[vlc-commits] vlc_Log: allow NULL vlc_object_t parameter

Rafaël Carré git at videolan.org
Mon Mar 25 15:16:23 CET 2013


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Mon Mar 25 15:15:34 2013 +0100| [46cd3b97940b60ff3e54b9405a50a8b4564093bd] | committer: Rafaël Carré

vlc_Log: allow NULL vlc_object_t parameter

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

 src/misc/messages.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/misc/messages.c b/src/misc/messages.c
index 780fb65..0b5a3fd 100644
--- a/src/misc/messages.c
+++ b/src/misc/messages.c
@@ -160,19 +160,21 @@ void vlc_vaLog (vlc_object_t *obj, int type, const char *module,
         }
 
     /* Pass message to the callback */
-    libvlc_priv_t *priv = libvlc_priv (obj->p_libvlc);
+    libvlc_priv_t *priv = obj ? libvlc_priv (obj->p_libvlc) : NULL;
 
 #ifdef WIN32
     va_list ap;
 
     va_copy (ap, args);
-    Win32DebugOutputMsg (&priv->log.verbose, type, &msg, format, ap);
+    Win32DebugOutputMsg (priv ? &priv->log.verbose : NULL, type, &msg, format, ap);
     va_end (ap);
 #endif
 
-    vlc_rwlock_rdlock (&priv->log.lock);
-    priv->log.cb (priv->log.opaque, type, &msg, format, args);
-    vlc_rwlock_unlock (&priv->log.lock);
+    if (priv) {
+        vlc_rwlock_rdlock (&priv->log.lock);
+        priv->log.cb (priv->log.opaque, type, &msg, format, args);
+        vlc_rwlock_unlock (&priv->log.lock);
+    }
 
     uselocale (locale);
     freelocale (c);



More information about the vlc-commits mailing list