Fix trash restore crash

No message selected, makes an attempt to index nil value
This commit is contained in:
Athozus 2023-06-18 19:06:12 +02:00
parent bfd3692280
commit 968f402566
No known key found for this signature in database
GPG Key ID: B50895022E8484BF

View File

@ -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