[gnome-builder] diagnostics: fix critical about NULL diagnostics
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] diagnostics: fix critical about NULL diagnostics
- Date: Mon, 14 Sep 2020 18:20:35 +0000 (UTC)
commit 65c30a88d9440a30b706b34a7ff34420c9dff859
Author: Christian Hergert <chergert redhat com>
Date: Mon Sep 14 11:20:13 2020 -0700
diagnostics: fix critical about NULL diagnostics
src/libide/sourceview/ide-source-view.c | 2 ++
src/plugins/editor/gbp-editor-hover-provider.c | 10 ++++++----
2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/libide/sourceview/ide-source-view.c b/src/libide/sourceview/ide-source-view.c
index a7cd3ad44..bb681664a 100644
--- a/src/libide/sourceview/ide-source-view.c
+++ b/src/libide/sourceview/ide-source-view.c
@@ -4530,6 +4530,8 @@ ide_source_view_real_populate_popup (GtkTextView *text_view,
*/
if ((diagnostics = ide_buffer_get_diagnostics (IDE_BUFFER (buffer))))
{
+ g_assert (IDE_IS_DIAGNOSTICS (diagnostics));
+
line_diags = ide_diagnostics_get_diagnostics_at_line (diagnostics,
ide_buffer_get_file (IDE_BUFFER (buffer)),
gtk_text_iter_get_line (&iter));
diff --git a/src/plugins/editor/gbp-editor-hover-provider.c b/src/plugins/editor/gbp-editor-hover-provider.c
index b6ff1c5fc..4441ee604 100644
--- a/src/plugins/editor/gbp-editor-hover-provider.c
+++ b/src/plugins/editor/gbp-editor-hover-provider.c
@@ -64,11 +64,13 @@ gbp_editor_hover_provider_hover_async (IdeHoverProvider *provider,
IdeDiagnostics *diagnostics;
g_autoptr(GPtrArray) line_diags = NULL;
- diagnostics = ide_buffer_get_diagnostics (IDE_BUFFER (buffer));
- line_diags = ide_diagnostics_get_diagnostics_at_line (diagnostics, file, line);
- IDE_PTR_ARRAY_SET_FREE_FUNC (line_diags, g_object_unref);
+ if ((diagnostics = ide_buffer_get_diagnostics (IDE_BUFFER (buffer))))
+ {
+ line_diags = ide_diagnostics_get_diagnostics_at_line (diagnostics, file, line);
+ IDE_PTR_ARRAY_SET_FREE_FUNC (line_diags, g_object_unref);
+ }
- if (diagnostics && line_diags)
+ if (diagnostics != NULL && line_diags != NULL)
{
for (guint i = 0; i < line_diags->len; i++)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]