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
This commit is contained in:
Matthias Clasen 2024-02-21 07:13:12 -05:00
parent 33f210bc85
commit 239d47791d

View File

@ -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);