1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-11 13:50:48 -05:00

[DMenu] Do not crash when no entry is available.

Issue: #1504
This commit is contained in:
Dave Davenport 2021-10-16 01:39:21 +02:00
parent ec7aa09f0a
commit 06bb72d39b
2 changed files with 10 additions and 4 deletions

View file

@ -545,9 +545,11 @@ static void dmenu_print_results(DmenuModePrivateData *pd, const char *input) {
if (pd->selected_line != UINT32_MAX) { if (pd->selected_line != UINT32_MAX) {
cmd = cmd_list[pd->selected_line].entry; cmd = cmd_list[pd->selected_line].entry;
} }
if ( cmd ) {
rofi_output_formatted_line(pd->format, cmd, pd->selected_line, input); rofi_output_formatted_line(pd->format, cmd, pd->selected_line, input);
} }
} }
}
static void dmenu_finalize(RofiViewState *state) { static void dmenu_finalize(RofiViewState *state) {
int retv = FALSE; int retv = FALSE;

View file

@ -1678,8 +1678,12 @@ static WidgetTriggerActionResult textbox_button_trigger_action(
case MOUSE_CLICK_DOWN: { case MOUSE_CLICK_DOWN: {
const char *type = rofi_theme_get_string(wid, "action", NULL); const char *type = rofi_theme_get_string(wid, "action", NULL);
if (type ) { if (type ) {
if ( state->list_view) {
(state->selected_line) = (state->selected_line) =
state->line_map[listview_get_selected(state->list_view)]; state->line_map[listview_get_selected(state->list_view)];
} else {
(state->selected_line) = UINT32_MAX;
}
guint id = key_binding_get_action_from_name(type); guint id = key_binding_get_action_from_name(type);
if (id != UINT32_MAX) { if (id != UINT32_MAX) {
rofi_view_trigger_global_action(id); rofi_view_trigger_global_action(id);