From 5127c79c2069e3fe9d3ea4c327c67fb5bfe51c2f Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 12 Aug 2016 21:54:15 +0200 Subject: Prevent next/prev crash when catsel==nil --- init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.lua b/init.lua index 2fc7917..6d27a81 100644 --- a/init.lua +++ b/init.lua @@ -430,6 +430,7 @@ function doc.process_form(player,formname,fields) local formspec = doc.formspec_core(2)..doc.formspec_category(doc.data.players[playername].category, playername) minetest.show_formspec(playername, "doc:category", formspec) elseif fields["doc_button_goto_next"] then + if doc.data.players[playername].catsel == nil then return end -- emergency exit local eids = doc.data.players[playername].entry_ids local cid = doc.data.players[playername].category local new_catsel= doc.data.players[playername].catsel + 1 @@ -442,6 +443,7 @@ function doc.process_form(player,formname,fields) doc.data.players[playername].entry = new_eid end elseif fields["doc_button_goto_prev"] then + if doc.data.players[playername].catsel == nil then return end -- emergency exit local eids = doc.data.players[playername].entry_ids local cid = doc.data.players[playername].category local new_catsel= doc.data.players[playername].catsel - 1 -- cgit v1.2.3