some error handling for fs.dir(...) == nil
[project/luci.git] / applications / luci-statistics / luasrc / statistics / datatree.lua
index ba6d774..327b8ef 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