prevent crash when typing spaces at the end of text box with word wrap
@@ -324,7 +324,7 @@ impl FormattedText {
}
WrapMode::Word => {
if word_ended {
- let word = word.take().unwrap();
+ if let Some(word) = word.take() {
if word.width > self.constraint.x {
// The word is longer than available constraints.
// Push the word as a whole.
@@ -349,6 +349,7 @@ impl FormattedText {
current_line.end += word.length;
}
}
+ }
// White-space characters are not part of word so pass them through.
if is_white_space {
