From 46cd3b97940b60ff3e54b9405a50a8b4564093bd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C3=ABl=20Carr=C3=A9?= Date: Mon, 25 Mar 2013 15:15:34 +0100 Subject: [PATCH] vlc_Log: allow NULL vlc_object_t parameter --- 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 780fb65fec..0b5a3fd147 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); -- 2.39.5