summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-olsr/luasrc
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-08-17 20:29:00 +0000
committerSteven Barth <steven@midlink.org>2008-08-17 20:29:00 +0000
commitb0144108a8affb16ed7731608c110a70aac044db (patch)
tree720651add203a4ee2a82b443a66936997c14537e /applications/luci-olsr/luasrc
parent4f2bf621beff771fb069b31880be36c13ef76c4c (diff)
Second try...
Diffstat (limited to 'applications/luci-olsr/luasrc')
-rw-r--r--applications/luci-olsr/luasrc/controller/olsr.lua18
1 files changed, 12 insertions, 6 deletions
diff --git a/applications/luci-olsr/luasrc/controller/olsr.lua b/applications/luci-olsr/luasrc/controller/olsr.lua
index d478df058d..577f596ca6 100644
--- a/applications/luci-olsr/luasrc/controller/olsr.lua
+++ b/applications/luci-olsr/luasrc/controller/olsr.lua
@@ -45,15 +45,18 @@ function action_index()
end
local function compare(a, b)
- if tonumber(a.ETX) == 0 then
+ local c = tonumber(a.ETX)
+ local d = tonumber(b.ETX)
+
+ if not c or c == 0 then
return false
end
- if tonumber(b.ETX) == 0 then
+ if not d or d == 0 then
return true
end
- return tonumber(a.ETX) < tonumber(b.ETX)
+ return c < d
end
table.sort(data.Links, compare)
@@ -70,15 +73,18 @@ function action_routes()
end
local function compare(a, b)
- if tonumber(a.ETX) == 0 then
+ local c = tonumber(a.ETX)
+ local d = tonumber(b.ETX)
+
+ if not c or c == 0 then
return false
end
- if tonumber(b.ETX) == 0 then
+ if not d or d == 0 then
return true
end
- return tonumber(a.ETX) < tonumber(b.ETX)
+ return c < d
end
table.sort(data.Routes, compare)