From 7557c5bcef137e7e27c4dd56325a633231d91cc8 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 3 Jun 2008 22:50:21 +0000 Subject: [PATCH] some error handling for fs.dir(...) == nil --- applications/luci-statistics/luasrc/statistics/datatree.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/applications/luci-statistics/luasrc/statistics/datatree.lua b/applications/luci-statistics/luasrc/statistics/datatree.lua index ba6d7740b..327b8ef36 100644 --- a/applications/luci-statistics/luasrc/statistics/datatree.lua +++ b/applications/luci-statistics/luasrc/statistics/datatree.lua @@ -44,7 +44,11 @@ function Instance._notzero( self, table ) end function Instance._scan( self ) - for i, plugin in ipairs( fs.dir( self._libdir ) ) do + local dir = fs.dir( self._libdir ) + if not dir then + return + end + for i, plugin in ipairs( dir ) do if plugin:match("%w+.so") then self._plugins[ plugin:gsub(".so", "") ] = { } end -- 2.25.1