[vlc-commits] Allow logging error messages with no VLC object (NULL)
Rémi Denis-Courmont
git at videolan.org
Sun Aug 21 16:17:28 CEST 2011
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Aug 21 17:16:56 2011 +0300| [cfe30ad2ecd7ba1915cd414cc7d04778dde124d6] | committer: Rémi Denis-Courmont
Allow logging error messages with no VLC object (NULL)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cfe30ad2ecd7ba1915cd414cc7d04778dde124d6
---
src/misc/messages.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/misc/messages.c b/src/misc/messages.c
index 21fe81b..8bc8b16 100644
--- a/src/misc/messages.c
+++ b/src/misc/messages.c
@@ -113,7 +113,7 @@ void vlc_Unsubscribe (msg_subscription_t *sub)
/**
* Emit a log message.
- * \param obj VLC object emitting the message
+ * \param obj VLC object emitting the message or NULL
* \param type VLC_MSG_* message type (info, error, warning or debug)
* \param module name of module from which the message come
* (normally MODULE_STRING)
@@ -140,9 +140,7 @@ static void PrintMsg (void *, int, const msg_item_t *, const char *, va_list);
void vlc_vaLog (vlc_object_t *obj, int type, const char *module,
const char *format, va_list args)
{
- assert (obj != NULL);
-
- if (obj->i_flags & OBJECT_FLAGS_QUIET)
+ if (obj != NULL && obj->i_flags & OBJECT_FLAGS_QUIET)
return;
/* C locale to get error messages in English in the logs */
@@ -209,7 +207,7 @@ void vlc_vaLog (vlc_object_t *obj, int type, const char *module,
msg_item_t msg;
msg.i_object_id = (uintptr_t)obj;
- msg.psz_object_type = obj->psz_object_type;
+ msg.psz_object_type = (obj != NULL) ? obj->psz_object_type : "generic";
msg.psz_module = module;
msg.psz_header = NULL;
More information about the vlc-commits
mailing list