From 94beeb14c919547eb949a6ffeeadbfb2c3761cc9 Mon Sep 17 00:00:00 2001 From: Federico Cecchetto Date: Sun, 6 Feb 2022 21:57:00 +0100 Subject: [PATCH] Check that mod is a folder and not empty --- data/ui_scripts/mods/loading.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/data/ui_scripts/mods/loading.lua b/data/ui_scripts/mods/loading.lua index 85acffb1..18fab2c8 100644 --- a/data/ui_scripts/mods/loading.lua +++ b/data/ui_scripts/mods/loading.lua @@ -85,14 +85,16 @@ LUI.MenuBuilder.m_types_build["mods_menu"] = function(a1) if (io.directoryexists("mods")) then local mods = io.listfiles("mods/") for i = 1, #mods do - local name, desc = getmodname(mods[i]) + if (io.directoryexists(mods[i]) and not io.directoryisempty(mods[i])) then + local name, desc = getmodname(mods[i]) - if (mods[i] ~= modfolder) then - menu:AddButton("$_" .. name, function() - game:executecommand("loadmod " .. mods[i]) - end, nil, true, nil, { - desc_text = desc - }) + if (mods[i] ~= modfolder) then + menu:AddButton("$_" .. name, function() + game:executecommand("loadmod " .. mods[i]) + end, nil, true, nil, { + desc_text = desc + }) + end end end end