diff options
-rw-r--r-- | dnscache-model.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/dnscache-model.lua b/dnscache-model.lua index 46684cf..6ceac36 100644 --- a/dnscache-model.lua +++ b/dnscache-model.lua @@ -68,7 +68,7 @@ function getstatus() end function getconfig() - local conf = format.parse_ini_file(fs.read_file(configfile), "") or {} + local conf = format.parse_ini_file(fs.read_file(configfile) or "", "") or {} local output = {} output.IPSEND = cfe({ value = conf.IPSEND or "", label="IP address for requests", descr="Use 0.0.0.0 for default address" }) @@ -83,7 +83,7 @@ function setconfig(config) local success, config = validateconfig(config) if success then - local file = fs.read_file(configfile) + local file = fs.read_file(configfile) or "" file = format.update_ini_file(file,"","IPSEND",config.value.IPSEND.value) file = format.update_ini_file(file,"","CACHESIZE",config.value.CACHESIZE.value) file = format.update_ini_file(file,"","IP",config.value.IP.value) @@ -202,7 +202,7 @@ function getDomain(getdomainname) end end if not domain.errtxt then - local content = fs.read_file(baseurl.."servers/"..getdomainname) + local content = fs.read_file(baseurl.."servers/"..getdomainname) or "" for name in string.gmatch(content.."\n", "([^\n]+)\n") do table.insert(iplist.value, name) end |