summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2016-08-12 21:54:15 +0200
committerWuzzy <almikes@aol.com>2016-08-12 21:54:15 +0200
commit5127c79c2069e3fe9d3ea4c327c67fb5bfe51c2f (patch)
tree80888811c7e9ae7cee1b07ee45a328639d2d4c24 /init.lua
parentebda8931ab57b0467d1b155c5f470454d8d2dd6d (diff)
Prevent next/prev crash when catsel==nil
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua2
1 files changed, 2 insertions, 0 deletions
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