some error handling for fs.dir(...) == nil
authorFelix Fietkau <nbd@openwrt.org>
Tue, 3 Jun 2008 22:50:21 +0000 (22:50 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 3 Jun 2008 22:50:21 +0000 (22:50 +0000)
applications/luci-statistics/luasrc/statistics/datatree.lua

index ba6d7740b1b055ed6d599f2563120c5ef3fa9eae..327b8ef36ad1e51cb6b291890a6a4f0baedc69f7 100644 (file)
@@ -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