From a0d143aad926eea715e470d50a80fdac02b12c95 Mon Sep 17 00:00:00 2001 From: Y Date: Sun, 17 Sep 2017 18:23:32 +0200 Subject: [PATCH] Avoid lua error in helpers.lua: for url, name in pairs(conf["users"][user]) do --- helpers.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/helpers.lua b/helpers.lua index 9afa349..786076c 100644 --- a/helpers.lua +++ b/helpers.lua @@ -540,14 +540,16 @@ function get_data_for(view) -- Add user's accessible URLs using the ACLs. -- It is typically used to build the app list. - for url, name in pairs(conf["users"][user]) do + if conf["users"][user] then + for url, name in pairs(conf["users"][user]) do - if ngx.var.host == conf["local_portal_domain"] then - url = string.gsub(url, conf["original_portal_domain"], conf["local_portal_domain"]) + if ngx.var.host == conf["local_portal_domain"] then + url = string.gsub(url, conf["original_portal_domain"], conf["local_portal_domain"]) + end + table.insert(sorted_apps, name) + table.sort(sorted_apps) + table.insert(data["app"], index_of(sorted_apps, name), { url = url, name = name }) end - table.insert(sorted_apps, name) - table.sort(sorted_apps) - table.insert(data["app"], index_of(sorted_apps, name), { url = url, name = name }) end end