[gnome-builder] code-assist: short circuit if there is no local file location.



commit 8ebf6753562488e18415ca11d2ef6076abab1913
Author: Christian Hergert <christian hergert me>
Date:   Fri Nov 21 02:18:39 2014 -0800

    code-assist: short circuit if there is no local file location.

 src/editor/gb-editor-code-assistant.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/editor/gb-editor-code-assistant.c b/src/editor/gb-editor-code-assistant.c
index b19e83a..4c38b9a 100644
--- a/src/editor/gb-editor-code-assistant.c
+++ b/src/editor/gb-editor-code-assistant.c
@@ -284,8 +284,8 @@ gb_editor_code_assistant_parse (gpointer user_data)
   GVariant *cursor;
   GVariant *options;
   GFile *location;
-  gchar *path;
-  gchar *text;
+  gchar *path = NULL;
+  gchar *text = NULL;
 
   ENTRY;
 
@@ -301,6 +301,9 @@ gb_editor_code_assistant_parse (gpointer user_data)
   g_file_set_contents (priv->gca_tmpfile, text, -1, NULL);
 
   location = gtk_source_file_get_location (priv->file);
+  if (!location)
+    goto cleanup;
+
   path = g_file_get_path (location);
 
   cursor = g_variant_new ("(xx)",
@@ -320,6 +323,7 @@ gb_editor_code_assistant_parse (gpointer user_data)
                           gb_editor_code_assistant_parse_cb,
                           g_object_ref (tab));
 
+cleanup:
   g_free (path);
   g_free (text);
 


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