aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2015-07-21 21:55:58 +0200
committersfan5 <sfan5@live.de>2015-07-21 21:55:58 +0200
commit5b0c719171eb9ccb8f2829eb1cc8b3fe9f24cd05 (patch)
tree7adc71bdfda1f161ec4b406ab31c07fdc814a4c1
parent254dbe7abd255075b16db35b821566ed51fa850e (diff)
downloadminetest-5b0c719171eb9ccb8f2829eb1cc8b3fe9f24cd05.tar.gz
minetest-5b0c719171eb9ccb8f2829eb1cc8b3fe9f24cd05.tar.bz2
minetest-5b0c719171eb9ccb8f2829eb1cc8b3fe9f24cd05.zip
Fix crash in mainmenu when loaded subgame does not have a "menu" directory
-rw-r--r--builtin/mainmenu/textures.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin/mainmenu/textures.lua b/builtin/mainmenu/textures.lua
index 700bdb5cc..075f38ee0 100644
--- a/builtin/mainmenu/textures.lua
+++ b/builtin/mainmenu/textures.lua
@@ -144,10 +144,11 @@ function mm_texture.set_game(identifier, gamedetails)
end
-- Find out how many randomized textures the subgame provides
- local n, filename
+ local n = 0
+ local filename
local menu_files = core.get_dir_list(gamedetails.path .. DIR_DELIM .. "menu", false)
for i = 1, #menu_files do
- local filename = identifier .. "." .. i .. ".png"
+ filename = identifier .. "." .. i .. ".png"
if table.indexof(menu_files, filename) == -1 then
n = i - 1
break