[gnome-builder/wip/libide] libide: ensure valid language for gnome-code-assistance



commit 657b340d9b1a7f50e47c6a30521b35b033a47af1
Author: Christian Hergert <christian hergert me>
Date:   Mon Mar 2 23:30:49 2015 -0800

    libide: ensure valid language for gnome-code-assistance

 libide/gca/ide-gca-diagnostic-provider.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/libide/gca/ide-gca-diagnostic-provider.c b/libide/gca/ide-gca-diagnostic-provider.c
index 0279504..54482df 100644
--- a/libide/gca/ide-gca-diagnostic-provider.c
+++ b/libide/gca/ide-gca-diagnostic-provider.c
@@ -363,10 +363,20 @@ ide_gca_diagnostic_provider_diagnose_async (IdeDiagnosticProvider *provider,
 
   task = g_task_new (self, cancellable, callback, user_data);
 
-  context = ide_object_get_context (IDE_OBJECT (provider));
-  service = ide_context_get_service_typed (context, IDE_TYPE_GCA_SERVICE);
   language = ide_file_get_language (file);
   language_id = ide_language_get_id (language);
+
+  if (!language_id)
+    {
+      g_task_return_new_error (task,
+                               G_IO_ERROR,
+                               G_IO_ERROR_NOT_SUPPORTED,
+                               "No language specified, code assistance not supported.");
+      return;
+    }
+
+  context = ide_object_get_context (IDE_OBJECT (provider));
+  service = ide_context_get_service_typed (context, IDE_TYPE_GCA_SERVICE);
   files = ide_context_get_unsaved_files (context);
   gfile = ide_file_get_file (file);
 


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