mod_register_apps: Fix removal of apps from array on unload
authorKim Alvefur <zash@zash.se>
Sat, 10 Oct 2020 16:54:06 +0200
changeset 4191 e2db07017332
parent 4190 aba0470ed725
child 4192 4611999fd8d3
mod_register_apps: Fix removal of apps from array on unload
mod_register_apps/mod_register_apps.lua
--- a/mod_register_apps/mod_register_apps.lua	Sat Oct 10 16:52:36 2020 +0200
+++ b/mod_register_apps/mod_register_apps.lua	Sat Oct 10 16:54:06 2020 +0200
@@ -133,6 +133,11 @@
 
 local function remove_app(app_info)
 	local app_id = app_info.id or app_info.name:gsub("%W+", "-"):lower();
+	for i = #site_apps, 1, -1 do
+		if site_apps[i].id == app_id then
+			table.remove(site_apps, i);
+		end
+	end
 	site_apps[app_id] = nil;
 end