From b2942d9cc8631275fe8abdc53bd518b5b9f9ffcc Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 8 Oct 2009 19:12:47 -0400 Subject: Checking to see if a file exists before trying to load it. --- libindicator/indicator-object.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c index 7188a07..9fc439e 100644 --- a/libindicator/indicator-object.c +++ b/libindicator/indicator-object.c @@ -88,6 +88,11 @@ indicator_object_new_from_file (const gchar * file) return NULL; } + if (!g_file_test(file, G_FILE_TEST_EXISTS)) { + g_warning("File '%s' does not exist.", file); + return NULL; + } + GModule * module = g_module_open(file, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL); if(module != NULL) { -- cgit v1.2.3