From ae709ed1ddd94d9ddcf7ca42a1cdc9c99808e80b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 25 Dec 2016 11:07:10 +0100 Subject: [PATCH] Fix bug in word wrapper --- ext/native/util/text/wrap_text.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/native/util/text/wrap_text.cpp b/ext/native/util/text/wrap_text.cpp index 6f40106455..e63733225d 100644 --- a/ext/native/util/text/wrap_text.cpp +++ b/ext/native/util/text/wrap_text.cpp @@ -75,7 +75,7 @@ std::string WordWrapper::Wrapped() { } void WordWrapper::WrapBeforeWord() { - if (x_ + wordWidth_ > maxW_) { + if (x_ + wordWidth_ > maxW_ && out_.size() > 0) { if (IsShy(out_[out_.size() - 1])) { // Soft hyphen, replace it with a real hyphen since we wrapped at it. // TODO: There's an edge case here where the hyphen might not fit.