[gtksourceview/wip/fix-search: 4/4] SearchContext: check return value of iterator_get_subregion()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/fix-search: 4/4] SearchContext: check return value of iterator_get_subregion()
- Date: Thu, 5 Mar 2015 10:32:50 +0000 (UTC)
commit a93f607f13da2e337fdd00432160f13838d0d54c
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 c80c6a9..5b92558 100644
--- a/gtksourceview/gtksourcesearchcontext.c
+++ b/gtksourceview/gtksourcesearchcontext.c
@@ -436,9 +436,12 @@ is_text_region_empty (GtkTextRegion *region)
GtkTextIter region_start;
GtkTextIter region_end;
- gtk_text_region_iterator_get_subregion (®ion_iter,
- ®ion_start,
- ®ion_end);
+ if (!gtk_text_region_iterator_get_subregion (®ion_iter,
+ ®ion_start,
+ ®ion_end))
+ {
+ return TRUE;
+ }
if (!gtk_text_iter_equal (®ion_start, ®ion_end))
{
@@ -470,7 +473,10 @@ get_first_subregion (GtkTextRegion *region,
while (!gtk_text_region_iterator_is_end (®ion_iter))
{
- gtk_text_region_iterator_get_subregion (®ion_iter, start, end);
+ if (!gtk_text_region_iterator_get_subregion (®ion_iter, start, end))
+ {
+ return FALSE;
+ }
if (!gtk_text_iter_equal (start, end))
{
@@ -506,9 +512,12 @@ get_last_subregion (GtkTextRegion *region,
GtkTextIter start_subregion;
GtkTextIter end_subregion;
- gtk_text_region_iterator_get_subregion (®ion_iter,
- &start_subregion,
- &end_subregion);
+ if (!gtk_text_region_iterator_get_subregion (®ion_iter,
+ &start_subregion,
+ &end_subregion))
+ {
+ return FALSE;
+ }
if (!gtk_text_iter_equal (&start_subregion, &end_subregion))
{
@@ -1823,9 +1832,12 @@ regex_search_handle_high_priority_region (GtkSourceSearchContext *search)
GtkTextIter subregion_start;
GtkTextIter subregion_end;
- gtk_text_region_iterator_get_subregion (®ion_iter,
- &subregion_start,
- &subregion_end);
+ if (!gtk_text_region_iterator_get_subregion (®ion_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]