1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-03 04:23:42 -05:00

issue: #79: Crash when enter on empty list.

* This fixes the reproducable part of the bug. (enter on empty list)
    * check selected < filtered_lines. so we do not try to dereference a null pointer.
This commit is contained in:
Dave Davenport 2014-08-25 17:48:42 +02:00
parent 26e1561622
commit 30051c8e80

View file

@ -1390,12 +1390,17 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom
if ( shift != NULL ) {
( *shift ) = ( ( ev.xkey.state & ShiftMask ) == ShiftMask );
}
if ( filtered[selected] != NULL ) {
// If a valid item is selected, return that..
if ( selected < filtered_lines && filtered[selected] != NULL ) {
retv = MENU_OK;
*selected_line = line_map[selected];
}
else{
// No item selected, but user entered something
else if ( strlen (text->text) > 0 ){
retv = MENU_CUSTOM_INPUT;
}else{
retv = MENU_CANCEL;
}
quit = TRUE;