[epiphany] find-toolbar: Correctly handle zero matches
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] find-toolbar: Correctly handle zero matches
- Date: Mon, 4 Nov 2019 15:55:36 +0000 (UTC)
commit 1a9108f334b3a08ac52b54a18520111f13c700f8
Author: Dimitrios Christidis <dimitrios christidis me>
Date: Sun Nov 3 19:34:05 2019 +0100
find-toolbar: Correctly handle zero matches
Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/984
embed/ephy-find-toolbar.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/embed/ephy-find-toolbar.c b/embed/ephy-find-toolbar.c
index 61b45aed2..b850183ed 100644
--- a/embed/ephy-find-toolbar.c
+++ b/embed/ephy-find-toolbar.c
@@ -598,18 +598,24 @@ ephy_find_toolbar_set_web_view (EphyFindToolbar *toolbar,
void
ephy_find_toolbar_find_next (EphyFindToolbar *toolbar)
{
- toolbar->current_match++;
- if (toolbar->current_match > toolbar->num_matches)
- toolbar->current_match = 1;
+ if (toolbar->num_matches) {
+ toolbar->current_match++;
+ if (toolbar->current_match > toolbar->num_matches)
+ toolbar->current_match = 1;
+ }
+
webkit_find_controller_search_next (toolbar->controller);
}
void
ephy_find_toolbar_find_previous (EphyFindToolbar *toolbar)
{
- toolbar->current_match--;
- if (toolbar->current_match < 1)
- toolbar->current_match = toolbar->num_matches;
+ if (toolbar->num_matches) {
+ g_assert (toolbar->current_match > 0);
+ toolbar->current_match--;
+ if (toolbar->current_match < 1)
+ toolbar->current_match = toolbar->num_matches;
+ }
webkit_find_controller_search_previous (toolbar->controller);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]