[gnome-builder] diagnostics: handle rename gracefully during Save As



commit 36ec2a13a9a9e596568fbd6f604e6e98ace6f163
Author: Christian Hergert <chergert redhat com>
Date:   Thu Nov 3 21:14:20 2016 -0700

    diagnostics: handle rename gracefully during Save As
    
    If we perform a Save As, we can have a crash due to the group not being
    available. This gracefully handles the error by creating the group
    immediately.

 libide/diagnostics/ide-diagnostics-manager.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/libide/diagnostics/ide-diagnostics-manager.c b/libide/diagnostics/ide-diagnostics-manager.c
index 9d843d1..da7d09e 100644
--- a/libide/diagnostics/ide-diagnostics-manager.c
+++ b/libide/diagnostics/ide-diagnostics-manager.c
@@ -645,6 +645,12 @@ ide_diagnostics_manager_find_group_from_buffer (IdeDiagnosticsManager *self,
   gfile = ide_file_get_file (ifile);
   group = g_hash_table_lookup (self->groups_by_file, gfile);
 
+  if (group == NULL)
+    {
+      group = ide_diagnostics_group_new (gfile);
+      g_hash_table_insert (self->groups_by_file, group->file, group);
+    }
+
   g_assert (group != NULL);
 
   return group;


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