[telepathy-gabble/master] Don't printf ("%s", NULL) for NULL resource/status

Will Thompson will.thompson at collabora.co.uk
Tue Jun 16 09:54:14 PDT 2009


printf ("%s", NULL); produces "(null)" with glibc, but crashes on
Windows.
---
 src/presence-cache.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/presence-cache.c b/src/presence-cache.c
index d2e25ba..59e157a 100644
--- a/src/presence-cache.c
+++ b/src/presence-cache.c
@@ -1565,7 +1565,10 @@ gabble_presence_cache_do_update (
 
   jid = tp_handle_inspect (contact_repo, handle);
   DEBUG ("%s (%d) resource %s prio %d presence %d message \"%s\"",
-      jid, handle, resource, priority, presence_id, status_message);
+      jid, handle,
+      resource == NULL ? "<null>" : resource,
+      priority, presence_id,
+      status_message == NULL ? "<null>" : status_message);
 
   presence = gabble_presence_cache_get (cache, handle);
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list