commit 30fd5dbf1b0f6f7f915ce0f1b6db69bdb9180fb8 parent aa7f57eed805adb09e9c59c8ea841870e8206b81 Author: Conrad Parker <conrad@metadecks.org> Date: Thu, 24 Aug 2017 09:54:42 +0800 Merge pull request #20 from MaskRay/master Fix #19 segfault when --append to empty selection Diffstat:
M | xsel.c | | | 12 | ++++++------ |
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/xsel.c b/xsel.c @@ -834,12 +834,12 @@ get_selection_text (Atom selection) static unsigned char * copy_sel (unsigned char * s) { - unsigned char * new_sel = NULL; - - new_sel = xs_strdup (s); - current_alloc = total_input = xs_strlen (s); - - return new_sel; + if (s) { + current_alloc = total_input = xs_strlen (s); + return xs_strdup (s); + } + current_alloc = total_input = 0; + return NULL; } /*