From eb002540a205697d07ad0d972fcd632cca84a9b9 Mon Sep 17 00:00:00 2001 From: Tigran Aivazian Date: Wed, 19 Sep 2012 17:49:20 +0100 Subject: [PATCH] Don't crash on user pressing ENTER in empty history --- just display an appropriate message. --- filehistory.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/filehistory.lua b/filehistory.lua index e5cffdcc8..d95d94959 100644 --- a/filehistory.lua +++ b/filehistory.lua @@ -199,6 +199,10 @@ function FileHistory:addAllCommands() self.commands:add({KEY_ENTER, KEY_FW_PRESS}, nil, "Enter", "open selected item", function(self) + if #self.result == 0 then + showInfoMsgWithDelay("No files to open", 1500, 1) + return + end file_entry = self.result[self.perpage*(self.page-1)+self.current] file_full_path = file_entry.dir .. "/" .. file_entry.name