summaryrefslogtreecommitdiff
path: root/desktop/textinput.c
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/textinput.c')
-rw-r--r--desktop/textinput.c11
1 files changed, 8 insertions, 3 deletions
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);