Merge pull request #2112 from chrox/fix_textbox

fix two crashes
This commit is contained in:
Qingping Hou
2016-06-27 11:44:20 -07:00
committed by GitHub
2 changed files with 6 additions and 1 deletions

View File

@@ -844,7 +844,10 @@ function Menu:onGotoPage(page)
end
function Menu:onSelect()
self:onMenuSelect(self.item_table[(self.page-1)*self.perpage+self.selected.y])
local item = self.item_table[(self.page-1)*self.perpage+self.selected.y]
if item then
self:onMenuSelect(item)
end
return true
end

View File

@@ -121,6 +121,7 @@ function TextBoxWidget:_splitCharWidthList()
local adjusted_width = cur_line_width
repeat
adjusted_width = adjusted_width - self.char_width_list[adjusted_idx].width
if adjusted_idx == 1 then break end
adjusted_idx = adjusted_idx - 1
c = self.char_width_list[adjusted_idx].char
until adjusted_idx > offset and util.isSplitable(c)
@@ -134,6 +135,7 @@ function TextBoxWidget:_splitCharWidthList()
end
end -- endif util.isSplitable(c)
end -- endif cur_line_width > self.width
if cur_line_width < 0 then break end
self.vertical_string_list[ln] = {
text = cur_line_text,
offset = offset,