[gnome-builder] gutter: handle NULL breakpoints gracefully



commit 6eb16f039e1fb499e4c497ae6a5f68fc598e8286
Author: Christian Hergert <chergert redhat com>
Date:   Tue Sep 19 02:01:53 2017 -0700

    gutter: handle NULL breakpoints gracefully

 libide/sourceview/ide-omni-gutter-renderer.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/libide/sourceview/ide-omni-gutter-renderer.c b/libide/sourceview/ide-omni-gutter-renderer.c
index 5d388f1..e3ec249 100644
--- a/libide/sourceview/ide-omni-gutter-renderer.c
+++ b/libide/sourceview/ide-omni-gutter-renderer.c
@@ -739,7 +739,6 @@ ide_omni_gutter_renderer_activate (GtkSourceGutterRenderer *renderer,
   g_assert (iter != NULL);
   g_assert (area != NULL);
   g_assert (event != NULL);
-  g_assert (self->breakpoints != NULL);
 
   /* TODO: We could check for event->button.button to see if we
    *       can display a popover with information such as
@@ -747,14 +746,19 @@ ide_omni_gutter_renderer_activate (GtkSourceGutterRenderer *renderer,
    */
 
   buffer = gtk_text_iter_get_buffer (iter);
-  context = ide_buffer_get_context (IDE_BUFFER (buffer));
-  debug_manager = ide_context_get_debug_manager (context);
 
   /* Select this row if it isn't currently selected */
   if (!gtk_text_buffer_get_selection_bounds (buffer, &begin, &end) &&
       gtk_text_iter_get_line (&begin) != gtk_text_iter_get_line (iter))
     gtk_text_buffer_select_range (buffer, iter, iter);
 
+  /* Nothing more we can do if this file doesn't support breakpoints */
+  if (self->breakpoints == NULL)
+    return;
+
+  context = ide_buffer_get_context (IDE_BUFFER (buffer));
+  debug_manager = ide_context_get_debug_manager (context);
+
   line = gtk_text_iter_get_line (iter) + 1;
   file = ide_debugger_breakpoints_get_file (self->breakpoints);
   path = g_file_get_path (file);


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