diff options
author | Dan Nicholson <dbn.lists@gmail.com> | 2012-10-13 09:06:18 -0700 |
---|---|---|
committer | Dan Nicholson <dbn.lists@gmail.com> | 2012-10-13 09:06:18 -0700 |
commit | 1184d2085a2a4d4cb7cae4caf0a21eb495206722 (patch) | |
tree | fd69543b8654a62e0260f5b24d6e1447e2cbd9c7 /main.c | |
parent | a14d489fbc17ddcb8481ef081abe0dacdc2a9a4a (diff) | |
download | pkg-config-1184d2085a2a4d4cb7cae4caf0a21eb495206722.tar.gz |
Don't crash on --print-variables when there are no variables
Apparently g_hash_table_foreach doesn't check for NULL input, so make
sure we don't call it to print the variables if the variable list is
empty.
Freedesktop #54721
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -580,9 +580,10 @@ main (int argc, char **argv) while (tmp != NULL) { Package *pkg = tmp->data; - g_hash_table_foreach(pkg->vars, - &print_hashtable_key, - NULL); + if (pkg->vars != NULL) + g_hash_table_foreach(pkg->vars, + &print_hashtable_key, + NULL); tmp = g_slist_next (tmp); if (tmp) printf ("\n"); } |