From 10cdd0e48e936d9c35ee3446e2540c4636c814aa Mon Sep 17 00:00:00 2001 From: Qball Cow Date: Tue, 6 Jan 2015 11:45:01 +0100 Subject: Do not crash on empty list in run dialog. --- source/run-dialog.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/run-dialog.c b/source/run-dialog.c index e7f1e35c..f3cdb2b2 100644 --- a/source/run-dialog.c +++ b/source/run-dialog.c @@ -225,6 +225,10 @@ static char ** get_apps ( char **retv, unsigned int *length ) if ( config.run_list_command != NULL && config.run_list_command[0] != '\0' ) { retv = get_apps_external ( retv, length ); } + // No sorting needed. + if((*length) == 0) { + return retv; + } // TODO: check this is still fast enough. (takes 1ms on laptop.) if ( ( *length ) > num_favorites ) { qsort ( &retv[num_favorites], ( *length ) - num_favorites, sizeof ( char* ), sort_func ); -- cgit v1.2.3