]> git.tdb.fi Git - libs/gltk.git/commitdiff
Ensure Text always has at least one line
authorMikko Rasa <tdb@tdb.fi>
Tue, 17 Sep 2019 19:48:56 +0000 (22:48 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 17 Sep 2019 19:48:56 +0000 (22:48 +0300)
Otherwise coords_to_geometry may access bogus data.

source/text.cpp

index a3ed762a2cd560754dcd973094e547d5977eae20..86730757fd6c93889b772ac648bbcd4913a98c85 100644 (file)
@@ -25,7 +25,14 @@ struct Text::CoordsToGeomData
 
 Text::Text():
        style(0)
-{ }
+{
+       Line line;
+       line.start = 0;
+       line.bytes = 0;
+       line.length = 0;
+       line.width = 0;
+       lines.push_back(line);
+}
 
 Text::Text(const Style &s, const string &t):
        style(&s)