When visiting the Configuration page under BMX, I get the following
error:

  /usr/lib/lua/luci/dispatcher.lua:433: Failed to execute cbi dispatcher target 
for entry '/admin/network/BMX6/Configuration'.
  The called action terminated with an exception:
  /usr/lib/lua/luci/model/cbi/bmx6/main.lua:54: bad argument #1 to 'ipairs' 
(table expected, got nil)
  stack traceback:
        [C]: in function 'assert'
        /usr/lib/lua/luci/dispatcher.lua:433: in function 'dispatch'
        /usr/lib/lua/luci/dispatcher.lua:168: in function 
</usr/lib/lua/luci/dispatcher.lua:167>

There is a check in main.lua for nil options but it just sets a
message and continues, causing the above error later on.  Adding a
return statement after setting the message causes the interface to at
least not die.

Signed-off-by: Bob Ham <r...@settrans.net>
---
 luci-app-bmx6/files/usr/lib/lua/luci/model/cbi/bmx6/main.lua | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/luci-app-bmx6/files/usr/lib/lua/luci/model/cbi/bmx6/main.lua 
b/luci-app-bmx6/files/usr/lib/lua/luci/model/cbi/bmx6/main.lua
index d4e0745..8ff3520 100644
--- a/luci-app-bmx6/files/usr/lib/lua/luci/model/cbi/bmx6/main.lua
+++ b/luci-app-bmx6/files/usr/lib/lua/luci/model/cbi/bmx6/main.lua
@@ -27,7 +27,8 @@ m = Map("bmx6", "bmx6")
 -- Getting json and Checking if bmx6-json is avaiable
 local options = bmx6json.get("options")
 if options == nil or options.OPTIONS == nil then
-        m.message = "bmx6-json plugin is not running or some mistake in 
luci-bmx6 configuration, check /etc/config/luci-bmx6"
+       m.message = "bmx6-json plugin is not running or some mistake in 
luci-bmx6 configuration, check /etc/config/luci-bmx6"
+       return m
 else
        options = options.OPTIONS
 end
-- 
2.1.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to