diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-08-25 23:09:41 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-08-25 23:09:41 -0300 |
commit | b0be30d9efb11aba10fd97c71fec47e34ea88ca1 (patch) | |
tree | e57d8515a5354c4aecb3ceaf4ad4235465fc0c96 /core/ustring.cpp | |
parent | d50921b55089e0396ee5f11675b6093dd49b7cbb (diff) | |
download | redot-engine-b0be30d9efb11aba10fd97c71fec47e34ea88ca1.tar.gz |
make sure array is created if not existing, as noted by Guilherme Felipe
Diffstat (limited to 'core/ustring.cpp')
-rw-r--r-- | core/ustring.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp index 32ef1eb5ff..ff7c8984fa 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -3057,12 +3057,11 @@ String String::world_wrap(int p_chars_per_line) const { if (i-from>=p_chars_per_line) { if (last_space==-1) { ret+=substr(from,i-from+1)+"\n"; - from=i+1; } else { ret+=substr(from,last_space-from)+"\n"; - i=last_space; - from=i+1; + i=last_space; //rewind } + from=i+1; last_space=-1; } else if (operator[](i)==' ' || operator[](i)=='\t') { last_space=i; |