Fix print coloring bug with empty strings (fixes #1171)

This commit is contained in:
Bart van Strien
2016-06-11 19:51:51 +02:00
parent 9900051647
commit b328049517
2 changed files with 6 additions and 0 deletions
+5
View File
@@ -387,6 +387,11 @@ void Font::getCodepointsFromString(const std::vector<ColoredString> &strs, Color
for (const ColoredString &cstr : strs)
{
// No need to add the color if the string is empty anyway, and the code
// further on assumes no two colors share the same starting position.
if (cstr.str.size() == 0)
continue;
IndexedColor c = {cstr.color, (int) codepoints.cps.size()};
codepoints.colors.push_back(c);