diff --git a/sys/apis/ui.lua b/sys/apis/ui.lua index f7363c0..f444c00 100644 --- a/sys/apis/ui.lua +++ b/sys/apis/ui.lua @@ -1219,7 +1219,7 @@ function UI.Page:focusNext() end function UI.Page:setFocus(child) - if not child.focus then + if not child or not child.focus then return end diff --git a/sys/apis/util.lua b/sys/apis/util.lua index 33344fa..eb50f58 100644 --- a/sys/apis/util.lua +++ b/sys/apis/util.lua @@ -489,6 +489,7 @@ function Util.insertString(str, istr, pos) end function Util.split(str, pattern) + if not str then error('Util:split: invalid parameters', 2) end pattern = pattern or "(.-)\n" local t = {} local function helper(line) table.insert(t, line) return "" end