diff options
author | Matthew Rasmus <mattr@zzntd.com> | 2014-11-27 11:42:40 -0800 |
---|---|---|
committer | Matthew Rasmus <mattr@zzntd.com> | 2014-12-16 11:06:55 -0800 |
commit | f686943eb40aa25e0a06837eeae6a907d9617d2b (patch) | |
tree | 55329be3dd1afc5dd3c16c64afb82bc248e338a1 /components/script/textinput.rs | |
parent | 905c30d69739fcacfe67cb2605eb9f669ae9a82f (diff) | |
download | servo-f686943eb40aa25e0a06837eeae6a907d9617d2b.tar.gz servo-f686943eb40aa25e0a06837eeae6a907d9617d2b.zip |
Fix crash in textinput
Diffstat (limited to 'components/script/textinput.rs')
-rw-r--r-- | components/script/textinput.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/components/script/textinput.rs b/components/script/textinput.rs index d39d22918c0..ed120aae943 100644 --- a/components/script/textinput.rs +++ b/components/script/textinput.rs @@ -295,6 +295,12 @@ impl TextInput { vec!(content) }; self.edit_point.line = min(self.edit_point.line, self.lines.len() - 1); - self.edit_point.index = min(self.edit_point.index, self.current_line_length() - 1); + + if self.current_line_length() == 0 { + self.edit_point.index = 0; + } + else { + self.edit_point.index = min(self.edit_point.index, self.current_line_length() - 1); + } } } |