[gtksourceview/gnome-3-14] SearchContext: check return value of iterator_get_subregion()



commit 444a5021a595b833872a93c12e2f1027ac0105ba
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Mar 5 11:27:15 2015 +0100

    SearchContext: check return value of iterator_get_subregion()

 gtksourceview/gtksourcesearchcontext.c |   32 ++++++++++++++++++++++----------
 1 files changed, 22 insertions(+), 10 deletions(-)
---
diff --git a/gtksourceview/gtksourcesearchcontext.c b/gtksourceview/gtksourcesearchcontext.c
index bc280ae..7507b77 100644
--- a/gtksourceview/gtksourcesearchcontext.c
+++ b/gtksourceview/gtksourcesearchcontext.c
@@ -425,9 +425,12 @@ is_text_region_empty (GtkTextRegion *region)
                GtkTextIter region_start;
                GtkTextIter region_end;
 
-               gtk_text_region_iterator_get_subregion (&region_iter,
-                                                       &region_start,
-                                                       &region_end);
+               if (!gtk_text_region_iterator_get_subregion (&region_iter,
+                                                            &region_start,
+                                                            &region_end))
+               {
+                       return TRUE;
+               }
 
                if (!gtk_text_iter_equal (&region_start, &region_end))
                {
@@ -459,7 +462,10 @@ get_first_subregion (GtkTextRegion *region,
 
        while (!gtk_text_region_iterator_is_end (&region_iter))
        {
-               gtk_text_region_iterator_get_subregion (&region_iter, start, end);
+               if (!gtk_text_region_iterator_get_subregion (&region_iter, start, end))
+               {
+                       return FALSE;
+               }
 
                if (!gtk_text_iter_equal (start, end))
                {
@@ -495,9 +501,12 @@ get_last_subregion (GtkTextRegion *region,
                GtkTextIter start_subregion;
                GtkTextIter end_subregion;
 
-               gtk_text_region_iterator_get_subregion (&region_iter,
-                                                       &start_subregion,
-                                                       &end_subregion);
+               if (!gtk_text_region_iterator_get_subregion (&region_iter,
+                                                            &start_subregion,
+                                                            &end_subregion))
+               {
+                       return FALSE;
+               }
 
                if (!gtk_text_iter_equal (&start_subregion, &end_subregion))
                {
@@ -1812,9 +1821,12 @@ regex_search_handle_high_priority_region (GtkSourceSearchContext *search)
                GtkTextIter subregion_start;
                GtkTextIter subregion_end;
 
-               gtk_text_region_iterator_get_subregion (&region_iter,
-                                                       &subregion_start,
-                                                       &subregion_end);
+               if (!gtk_text_region_iterator_get_subregion (&region_iter,
+                                                            &subregion_start,
+                                                            &subregion_end))
+               {
+                       return;
+               }
 
                gtk_text_buffer_remove_tag (search->priv->buffer,
                                            search->priv->found_tag,


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