Handle gracefully break requests of an empty string
This commit is contained in:
parent
893ac9d994
commit
de2d24a571
@ -926,6 +926,7 @@ namespace StringUtils
|
|||||||
irr::core::dimension2du area;
|
irr::core::dimension2du area;
|
||||||
// Algorithm :
|
// Algorithm :
|
||||||
// 1)If the index exceed the work_copy string size, go to step 7a)
|
// 1)If the index exceed the work_copy string size, go to step 7a)
|
||||||
|
// unless it is 0, in which case there is nothing to copy at all and it exits immediately.
|
||||||
// 2)We look at the character at the index
|
// 2)We look at the character at the index
|
||||||
// 3)We check if the current character is a linebreak. If yes, go to step 7a)
|
// 3)We check if the current character is a linebreak. If yes, go to step 7a)
|
||||||
// 4)We check if it is part of a multi-wchar unicode character.
|
// 4)We check if it is part of a multi-wchar unicode character.
|
||||||
@ -947,6 +948,9 @@ namespace StringUtils
|
|||||||
// Step 1
|
// Step 1
|
||||||
if (index >= work_copy.size())
|
if (index >= work_copy.size())
|
||||||
{
|
{
|
||||||
|
if (index==0)
|
||||||
|
break;
|
||||||
|
|
||||||
break_index = index-1;
|
break_index = index-1;
|
||||||
goto push_text; // Avoid complicating things with checks on every single step
|
goto push_text; // Avoid complicating things with checks on every single step
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user