luci-app-ddns: gracefully handle missing control file
In case `pcall()` fails, `ctrl` will contain an error message.
Fixes: 3395656b9f
("luci-app-ddns: get rid of luci-lib-ipkg depdency")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
3395656b9f
commit
74283264a3
1 changed files with 2 additions and 2 deletions
|
@ -160,8 +160,8 @@ local methods = {
|
||||||
local res = {}
|
local res = {}
|
||||||
local ver
|
local ver
|
||||||
|
|
||||||
local _, ctrl = pcall(io.lines, "/usr/lib/opkg/info/%s.control" % srv_name)
|
local ok, ctrl = pcall(io.lines, "/usr/lib/opkg/info/%s.control" % srv_name)
|
||||||
if ctrl then
|
if ok then
|
||||||
for line in ctrl do
|
for line in ctrl do
|
||||||
ver = line:match("^Version: (.+)$")
|
ver = line:match("^Version: (.+)$")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue