summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkliststore.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gtk/gtkliststore.c b/gtk/gtkliststore.c
index 95700acc9a..3a8c8e0e10 100644
--- a/gtk/gtkliststore.c
+++ b/gtk/gtkliststore.c
@@ -970,6 +970,7 @@ gtk_list_store_insert (GtkListStore *list_store,
GtkTreePath *path;
GtkSequence *seq;
GtkSequencePtr ptr;
+ gint length;
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
g_return_if_fail (iter != NULL);
@@ -979,6 +980,10 @@ gtk_list_store_insert (GtkListStore *list_store,
seq = list_store->seq;
+ length = _gtk_sequence_get_length (seq);
+ if (position > length)
+ position = length;
+
ptr = _gtk_sequence_get_ptr_at_pos (seq, position);
ptr = _gtk_sequence_insert (ptr, NULL);