Fix segfault when pressing PrintScr without a selection
authorRafa Garcia Gallego <rafael.garcia.gallego@gmail.com>
Wed, 26 Mar 2014 22:58:27 +0000 (23:58 +0100)
committerRoberto E. Vargas Caballero <k0ga@shike2.com>
Thu, 27 Mar 2014 06:48:32 +0000 (07:48 +0100)
st.c

diff --git a/st.c b/st.c
index e20a1e0..d58af7d 100644 (file)
--- a/st.c
+++ b/st.c
@@ -2263,9 +2263,10 @@ tdumpsel(void)
 {
        char *ptr;
 
-       ptr = getsel();
-       tprinter(ptr, strlen(ptr));
-       free(ptr);
+       if((ptr = getsel())) {
+               tprinter(ptr, strlen(ptr));
+               free(ptr);
+       }
 }
 
 void