[Xfce4-commits] <xfce4-panel:devel> Don't crash on a NULL hash table.
Nick Schermer
nick at xfce.org
Tue Aug 11 20:34:31 CEST 2009
Updating branch refs/heads/devel
to a01ff5a731fbf089e001c54d0dd7182fbe41ade2 (commit)
from 89319a65703b5f44f40cf2482bf1bf6f74d9c027 (commit)
commit a01ff5a731fbf089e001c54d0dd7182fbe41ade2
Author: Nick Schermer <nick at xfce.org>
Date: Mon Jun 1 01:53:01 2009 +0200
Don't crash on a NULL hash table.
panel/panel-application.c | 29 ++++++++++++++++++-----------
1 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/panel/panel-application.c b/panel/panel-application.c
index 9dd4d5f..80691b7 100644
--- a/panel/panel-application.c
+++ b/panel/panel-application.c
@@ -191,17 +191,20 @@ panel_application_init (PanelApplication *application)
/* get all the panel properties */
hash_table = xfconf_channel_get_properties (application->xfconf, NULL);
- /* check if we need to force all plugins to run external */
- value = g_hash_table_lookup (hash_table, "/force-all-external");
- if (value != NULL && g_value_get_boolean (value))
- panel_module_factory_force_all_external ();
+ if (G_LIKELY (hash_table != NULL))
+ {
+ /* check if we need to force all plugins to run external */
+ value = g_hash_table_lookup (hash_table, "/force-all-external");
+ if (value != NULL && g_value_get_boolean (value))
+ panel_module_factory_force_all_external ();
+
+ /* set the shared hash table */
+ panel_properties_shared_hash_table (hash_table);
+ }
/* get a factory reference so it never unloads */
application->factory = panel_module_factory_get ();
- /* set the shared hash table */
- panel_properties_shared_hash_table (hash_table);
-
/* load setup */
if (G_LIKELY (hash_table != NULL))
panel_application_load (application, hash_table);
@@ -213,11 +216,14 @@ panel_application_init (PanelApplication *application)
if (G_UNLIKELY (application->windows == NULL))
window = panel_application_new_window (application, NULL, TRUE);
- /* unset the shared hash table */
- panel_properties_shared_hash_table (NULL);
+ if (G_LIKELY (hash_table != NULL))
+ {
+ /* unset the shared hash table */
+ panel_properties_shared_hash_table (NULL);
- /* cleanup */
- g_hash_table_destroy (hash_table);
+ /* cleanup */
+ g_hash_table_destroy (hash_table);
+ }
}
@@ -310,6 +316,7 @@ panel_application_load (PanelApplication *application,
panel_return_if_fail (PANEL_IS_APPLICATION (application));
panel_return_if_fail (XFCONF_IS_CHANNEL (application->xfconf));
+ panel_return_if_fail (hash_table != NULL);
/* walk all the panel in the configuration */
value = g_hash_table_lookup (hash_table, "/panels");
More information about the Xfce4-commits
mailing list