[libpeas] Don't crash if there are no search paths



commit c6331e5f87d725bfa618cb8c4cf8991a1bb3c8ed
Author: Garrett Regier <alias301 gmail com>
Date:   Tue Jun 29 03:18:52 2010 -0700

    Don't crash if there are no search paths

 libpeas/peas-engine.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/libpeas/peas-engine.c b/libpeas/peas-engine.c
index c518208..4850ace 100644
--- a/libpeas/peas-engine.c
+++ b/libpeas/peas-engine.c
@@ -163,19 +163,25 @@ load_dir_real (PeasEngine  *engine,
 void
 peas_engine_rescan_plugins (PeasEngine *engine)
 {
+  gchar **sp;
   gchar *extension;
   guint i;
-  gchar **sp;
 
   g_return_if_fail (PEAS_IS_ENGINE (engine));
 
+  sp = engine->priv->search_paths;
+  if (sp == NULL)
+    {
+      g_debug ("No search paths where provided.");
+      return;
+    }
+
   /* Compute the extension of the plugin files. */
   extension = g_strdup_printf (".%s-plugin", engine->priv->app_name);
   for (i = 0; extension[i] != '\0'; ++i)
     extension[i] = g_ascii_tolower (extension[i]);
 
   /* Go and read everything from the provided search paths */
-  sp = engine->priv->search_paths;
   for (i = 0; sp[i] != NULL; i += 2)
     load_dir_real (engine, extension, sp[i], sp[i + 1], 1);
 



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