summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@blame.services>2021-10-16 01:39:21 +0200
committerDave Davenport <qball@blame.services>2021-10-16 01:39:21 +0200
commit06bb72d39bd86bf28d8653717cec000ffa484607 (patch)
treee5f5c6b562788bb3f9573d26e980da15bb8edd6e
parentec7aa09f0a1587040d2fc4822d8dd3e138bfce92 (diff)
[DMenu] Do not crash when no entry is available.
Issue: #1504
-rw-r--r--source/dialogs/dmenu.c4
-rw-r--r--source/view.c10
2 files changed, 10 insertions, 4 deletions
diff --git a/source/dialogs/dmenu.c b/source/dialogs/dmenu.c
index 647119fb..ee1b7ab7 100644
--- a/source/dialogs/dmenu.c
+++ b/source/dialogs/dmenu.c
@@ -545,7 +545,9 @@ static void dmenu_print_results(DmenuModePrivateData *pd, const char *input) {
if (pd->selected_line != UINT32_MAX) {
cmd = cmd_list[pd->selected_line].entry;
}
- rofi_output_formatted_line(pd->format, cmd, pd->selected_line, input);
+ if ( cmd ) {
+ rofi_output_formatted_line(pd->format, cmd, pd->selected_line, input);
+ }
}
}
diff --git a/source/view.c b/source/view.c
index 51e4437f..3010a08d 100644
--- a/source/view.c
+++ b/source/view.c
@@ -1677,9 +1677,13 @@ static WidgetTriggerActionResult textbox_button_trigger_action(
switch (action) {
case MOUSE_CLICK_DOWN: {
const char *type = rofi_theme_get_string(wid, "action", NULL);
- if (type) {
- (state->selected_line) =
- state->line_map[listview_get_selected(state->list_view)];
+ if (type ) {
+ if ( state->list_view) {
+ (state->selected_line) =
+ state->line_map[listview_get_selected(state->list_view)];
+ } else {
+ (state->selected_line) = UINT32_MAX;
+ }
guint id = key_binding_get_action_from_name(type);
if (id != UINT32_MAX) {
rofi_view_trigger_global_action(id);