r23366 - gnucash/trunk/src/libqof/qof - Avoid critical error from trying to access an uninitialized GHash.

John Ralls jralls at code.gnucash.org
Sat Nov 2 16:50:23 EDT 2013


Author: jralls
Date: 2013-11-02 16:50:23 -0400 (Sat, 02 Nov 2013)
New Revision: 23366
Trac: http://svn.gnucash.org/trac/changeset/23366

Modified:
   gnucash/trunk/src/libqof/qof/qoflog.c
Log:
Avoid critical error from trying to access an uninitialized GHash.

Modified: gnucash/trunk/src/libqof/qof/qoflog.c
===================================================================
--- gnucash/trunk/src/libqof/qof/qoflog.c	2013-11-02 20:49:48 UTC (rev 23365)
+++ gnucash/trunk/src/libqof/qof/qoflog.c	2013-11-02 20:50:23 UTC (rev 23366)
@@ -372,11 +372,12 @@
 
     {
         gpointer match_level;
-        if ((match_level = g_hash_table_lookup(log_levels, "")) != NULL)
+        if (log_levels &&
+	    (match_level = g_hash_table_lookup(log_levels, "")) != NULL)
             longest_match_level = (QofLogLevel)GPOINTER_TO_INT(match_level);
     }
 
-    _QLC_DBG( { printf("trying [%s] (%d):", log_domain, g_hash_table_size(log_levels)); });
+_QLC_DBG( { printf("trying [%s] (%d):", log_domain, log_levels != NULL ? g_hash_table_size(log_levels) : 0); });
     if (G_LIKELY(log_levels))
     {
         // e.g., "a.b.c\0" -> "a\0b.c\0" -> "a.b\0c\0", "a.b.c\0"



More information about the gnucash-changes mailing list