[vinagre] plugins: avoid NULL pointer without introspection



commit 8b9adf5a1573ff497e56d571f5bc9e22c39399a0
Author: Brett Witherspoon <spoonb exherbo org>
Date:   Fri Feb 25 18:26:48 2011 -0600

    plugins: avoid NULL pointer without introspection

 vinagre/vinagre-plugins-engine.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/vinagre/vinagre-plugins-engine.c b/vinagre/vinagre-plugins-engine.c
index 7c7ccff..0f87112 100644
--- a/vinagre/vinagre-plugins-engine.c
+++ b/vinagre/vinagre-plugins-engine.c
@@ -71,6 +71,13 @@ vinagre_plugins_engine_extension_added (PeasExtensionSet     *extensions,
 
   peas_extension_call (exten, "get_protocol", &protocol);
 
+  if (!protocol)
+    {
+      g_warning ("Unable to determine a protocol for the plugin %s",
+                 peas_plugin_info_get_name (info));
+      return;
+    }
+
   previous_ext = g_hash_table_lookup (engine->priv->protocols, protocol);
 
   if (previous_ext)
@@ -95,6 +102,13 @@ vinagre_plugins_engine_extension_removed (PeasExtensionSet     *extensions,
 
   peas_extension_call (exten, "get_protocol", &protocol);
 
+  if (!protocol)
+    {
+      g_warning ("Unable to determine a protocol for the plugin %s",
+                 peas_plugin_info_get_name (info));
+      return;
+    }
+
   g_hash_table_remove (engine->priv->protocols, (gpointer)protocol);
   g_signal_emit (engine, signals[PROTOCOL_REMOVED], 0, exten);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]