[gnome-builder] gca: check for valid language before getting id
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] gca: check for valid language before getting id
- Date: Wed, 20 Jul 2016 02:08:08 +0000 (UTC)
commit 8acc9ff4b6681c4fcabbbe266d19914d114ec3be
Author: Christian Hergert <chergert redhat com>
Date: Tue Jul 19 18:21:03 2016 -0700
gca: check for valid language before getting id
Fixes a CRITICAL warning for calling gtk_source_language_get_id() with a
NULL GtkSourceLanguage.
.../ide-gca-diagnostic-provider.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/plugins/gnome-code-assistance/ide-gca-diagnostic-provider.c
b/plugins/gnome-code-assistance/ide-gca-diagnostic-provider.c
index c2d4b67..ff36e9b 100644
--- a/plugins/gnome-code-assistance/ide-gca-diagnostic-provider.c
+++ b/plugins/gnome-code-assistance/ide-gca-diagnostic-provider.c
@@ -415,7 +415,7 @@ ide_gca_diagnostic_provider_diagnose_async (IdeDiagnosticProvider *provider,
GtkSourceLanguage *language;
IdeContext *context;
IdeUnsavedFiles *files;
- const gchar *language_id;
+ const gchar *language_id = NULL;
GFile *gfile;
IDE_ENTRY;
@@ -425,9 +425,11 @@ ide_gca_diagnostic_provider_diagnose_async (IdeDiagnosticProvider *provider,
task = g_task_new (self, cancellable, callback, user_data);
language = ide_file_get_language (file);
- language_id = gtk_source_language_get_id (language);
- if (!language_id)
+ if (language != NULL)
+ language_id = gtk_source_language_get_id (language);
+
+ if (language_id == NULL)
{
g_task_return_new_error (task,
G_IO_ERROR,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]