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:
Jo-Philipp Wich 2022-10-20 10:13:38 +02:00
parent 3395656b9f
commit 74283264a3

View file

@ -160,8 +160,8 @@ local methods = {
local res = {}
local ver
local _, ctrl = pcall(io.lines, "/usr/lib/opkg/info/%s.control" % srv_name)
if ctrl then
local ok, ctrl = pcall(io.lines, "/usr/lib/opkg/info/%s.control" % srv_name)
if ok then
for line in ctrl do
ver = line:match("^Version: (.+)$")