From 6674c715e061d87dcf3ce60cf9fa9159027896ab Mon Sep 17 00:00:00 2001 From: "kepler155c@gmail.com" Date: Wed, 5 Dec 2018 21:21:30 -0500 Subject: [PATCH] pcall driver init --- sys/apps/Network.lua | 9 +++++---- sys/extensions/1.device.lua | 5 ++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/sys/apps/Network.lua b/sys/apps/Network.lua index 04e223a..0fceb8c 100644 --- a/sys/apps/Network.lua +++ b/sys/apps/Network.lua @@ -43,14 +43,14 @@ local page = UI.Page { { text = 'Establish', event = 'trust' }, { text = 'Remove', event = 'untrust' }, } }, - { text = 'Help', event = 'help' }, + { text = 'Help', event = 'help', noCheck = true }, { text = '\206', x = -3, dropdown = { - { text = 'Show all', event = 'show_all' }, + { text = 'Show all', event = 'show_all', noCheck = true }, UI.MenuBar.spacer, - { text = 'Show trusted', event = 'show_trusted' }, + { text = 'Show trusted', event = 'show_trusted', noCheck = true }, }, }, }, @@ -159,6 +159,7 @@ This only needs to be done once. elseif event.type == 'show_all' then config.showTrusted = false + self.grid:setValues(network) Config.update('network', config) elseif event.type == 'show_trusted' then @@ -177,7 +178,7 @@ function page.menuBar:getActive(menuItem) local trustList = Util.readTable('usr/.known_hosts') or { } return t and trustList[t.id] end - return not not t + return menuItem.noCheck or not not t end function page.grid:getRowTextColor(row, selected) diff --git a/sys/extensions/1.device.lua b/sys/extensions/1.device.lua index e2e39f1..4eabc34 100644 --- a/sys/extensions/1.device.lua +++ b/sys/extensions/1.device.lua @@ -173,6 +173,9 @@ end -- initialize drivers for _,v in pairs(device) do if drivers[v.type] then - drivers[v.type](v) + local s, m = pcall(drivers[v.type], v) + if not s and m then + _G.printError(m) + end end end