From 239d47791d38000ce643a492a6c1edccb173ee0c Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 21 Feb 2024 07:13:12 -0500 Subject: [PATCH] editable: Less draconian preconditions Getting or deleting an empty string should be ok, and we do it ourselves, e.g. in the file chooser. Fixes: #6463 --- gtk/gtkeditable.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gtk/gtkeditable.c b/gtk/gtkeditable.c index 0312d5fae9..41fb0b729c 100644 --- a/gtk/gtkeditable.c +++ b/gtk/gtkeditable.c @@ -517,7 +517,7 @@ gtk_editable_delete_text (GtkEditable *editable, { g_return_if_fail (GTK_IS_EDITABLE (editable)); g_return_if_fail (start_pos >= 0); - g_return_if_fail (end_pos == -1 || end_pos > start_pos); + g_return_if_fail (end_pos == -1 || end_pos >= start_pos); GTK_EDITABLE_GET_IFACE (editable)->do_delete_text (editable, start_pos, end_pos); } @@ -552,7 +552,7 @@ gtk_editable_get_chars (GtkEditable *editable, g_return_val_if_fail (GTK_IS_EDITABLE (editable), NULL); g_return_val_if_fail (start_pos >= 0, NULL); - g_return_val_if_fail (end_pos == -1 || end_pos > start_pos, NULL); + g_return_val_if_fail (end_pos == -1 || end_pos >= start_pos, NULL); text = GTK_EDITABLE_GET_IFACE (editable)->get_text (editable); length = g_utf8_strlen (text, -1);