From 1c6012aae5cfa6336b9e4a2fc4986f028dea56be Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Tue, 29 Jul 2008 10:13:01 +0000 Subject: Assert first, before acting on selection svn path=/trunk/netsurf/; revision=4799 --- desktop/textinput.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'desktop/textinput.c') diff --git a/desktop/textinput.c b/desktop/textinput.c index cb642132f..65eaa20b3 100644 --- a/desktop/textinput.c +++ b/desktop/textinput.c @@ -1825,13 +1825,18 @@ bool delete_handler(struct browser_window *bw, struct box *b, void delete_selection(struct selection *s) { size_t start_offset, end_offset; - struct box *text_box = selection_get_start(s, &start_offset); - struct box *end_box = selection_get_end(s, &end_offset); + struct box *text_box; + struct box *end_box; struct box *next; - size_t sel_len = s->end_idx - s->start_idx; + size_t sel_len; int beginning = 0; + assert(s->defined); + text_box = selection_get_start(s, &start_offset); + end_box = selection_get_end(s, &end_offset); + sel_len = s->end_idx - s->start_idx; + /* Clear selection so that deletion from textboxes proceeds */ selection_clear(s, true); -- cgit v1.2.3