From 968f40256674faded4352e0f0aaeabc7227395d5 Mon Sep 17 00:00:00 2001 From: Athozus Date: Sun, 18 Jun 2023 19:06:12 +0200 Subject: [PATCH] Fix trash restore crash No message selected, makes an attempt to index nil value --- ui/events.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/events.lua b/ui/events.lua index 1d8a098..eead4f5 100644 --- a/ui/events.lua +++ b/ui/events.lua @@ -241,7 +241,9 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) mail.show_mail_menu(name, sortfieldindex, sortdirection, filter) elseif fields.restore then - mail.restore_mail(name, messagesTrash[mail.selected_idxs.trash[name]].id) + if messagesTrash[mail.selected_idxs.trash[name]] then + mail.restore_mail(name, messagesTrash[mail.selected_idxs.trash[name]].id) + end mail.show_mail_menu(name, sortfieldindex, sortdirection, filter) elseif fields.reply then