[anjuta] project-manager: Avoid a crash of anjuta when the project manager plugin is loaded without a project
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] project-manager: Avoid a crash of anjuta when the project manager plugin is loaded without a project
- Date: Wed, 22 Jun 2011 18:47:45 +0000 (UTC)
commit b357c172fb365ffe0847acc5ca407295dcdab7aa
Author: SÃbastien Granjoux <seb sfo free fr>
Date: Wed Jun 22 20:38:00 2011 +0200
project-manager: Avoid a crash of anjuta when the project manager plugin is loaded without a project open
plugins/project-manager/plugin.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/plugins/project-manager/plugin.c b/plugins/project-manager/plugin.c
index fb67293..76b8cf1 100644
--- a/plugins/project-manager/plugin.c
+++ b/plugins/project-manager/plugin.c
@@ -1765,6 +1765,12 @@ file_is_inside_project (ProjectManagerPlugin *plugin, GFile *file)
{
gchar *uri = g_file_get_uri (file);
gboolean inside = FALSE;
+
+ if (plugin->project_root_uri == NULL)
+ {
+ /* No project open */
+ return FALSE;
+ }
if (strncmp (uri, plugin->project_root_uri,
strlen (plugin->project_root_uri)) == 0)
@@ -1925,11 +1931,9 @@ iproject_manager_get_target_type (IAnjutaProjectManager *project_manager,
ANJUTA_PROJECT_UNKNOWN);
plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
-
- g_return_val_if_fail (file_is_inside_project (plugin, target_file),
- ANJUTA_PROJECT_UNKNOWN);
- if (plugin->project != NULL)
+ /* Check that file belongs to the project */
+ if ((plugin->project != NULL) && file_is_inside_project (plugin, target_file))
{
AnjutaProjectNode *node;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]