* luci/libs: uvl: fix crash when trying to validate malformed or not-existing configu...
authorJo-Philipp Wich <jow@openwrt.org>
Wed, 27 Aug 2008 18:55:42 +0000 (18:55 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Wed, 27 Aug 2008 18:55:42 +0000 (18:55 +0000)
libs/uvl/luasrc/uvl.lua
libs/uvl/luasrc/uvl/errors.lua

index 5cad3d2..24dc3a2 100644 (file)
@@ -971,7 +971,7 @@ section = luci.util.class(uvlitem)
 
 function section.__init__(self, scheme, co, c, s)
        self.cref = { c, s }
 
 function section.__init__(self, scheme, co, c, s)
        self.cref = { c, s }
-       self.sref = { c, co[s] and co[s]['.type'] or s }
+       self.sref = { c, co and co[s] and co[s]['.type'] or s }
        self.c    = co
        self.s    = scheme
        self.t    = luci.uvl.TYPE_SECTION
        self.c    = co
        self.s    = scheme
        self.t    = luci.uvl.TYPE_SECTION
@@ -1022,7 +1022,7 @@ option = luci.util.class(uvlitem)
 
 function option.__init__(self, scheme, co, c, s, o)
        self.cref = { c, s, o }
 
 function option.__init__(self, scheme, co, c, s, o)
        self.cref = { c, s, o }
-       self.sref = { c, co[s] and co[s]['.type'] or s, o }
+       self.sref = { c, co and co[s] and co[s]['.type'] or s, o }
        self.c    = co
        self.s    = scheme
        self.t    = luci.uvl.TYPE_OPTION
        self.c    = co
        self.s    = scheme
        self.t    = luci.uvl.TYPE_OPTION
@@ -1071,7 +1071,7 @@ enum = luci.util.class(option)
 
 function enum.__init__(self, scheme, co, c, s, o, v)
        self.cref = { c, s, o, v }
 
 function enum.__init__(self, scheme, co, c, s, o, v)
        self.cref = { c, s, o, v }
-       self.sref = { c, co[s] and co[s]['.type'] or s, o, v }
+       self.sref = { c, co and co[s] and co[s]['.type'] or s, o, v }
        self.c    = co
        self.s    = scheme
        self.t    = luci.uvl.TYPE_ENUM
        self.c    = co
        self.s    = scheme
        self.t    = luci.uvl.TYPE_ENUM
index cf7d287..f3ae4b9 100644 (file)
@@ -18,7 +18,7 @@ module( "luci.uvl.errors", package.seeall )
 require("luci.util")
 
 ERRCODES = {
 require("luci.util")
 
 ERRCODES = {
-       { 'UCILOAD',            'Unable to load config "%p"' },
+       { 'UCILOAD',            'Unable to load config "%p" (syntax error or file not found)' },
 
        { 'SCHEME',                     'Error in scheme "%p":\n%c' },
        { 'CONFIG',             'Error in config "%p":\n%c' },
 
        { 'SCHEME',                     'Error in scheme "%p":\n%c' },
        { 'CONFIG',             'Error in config "%p":\n%c' },