summaryrefslogtreecommitdiff
path: root/libs/canvas
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-10-29 03:13:59 +0200
committerRobin Gareus <robin@gareus.org>2016-10-29 19:57:43 +0200
commit5ed764178a7ff43d30ced21ffa8d5f36c64074c8 (patch)
tree704f4fbf476816fadd32a4301126cb440f8cf8ec /libs/canvas
parentc5d4900ea48152805814c277a3c37214ead930c9 (diff)
Fix crash with empty patch-names.
An empty text will not produce a bounding box.
Diffstat (limited to 'libs/canvas')
-rw-r--r--libs/canvas/flag.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/libs/canvas/flag.cc b/libs/canvas/flag.cc
index 2d0bdb2830..d0ce5af2b1 100644
--- a/libs/canvas/flag.cc
+++ b/libs/canvas/flag.cc
@@ -72,7 +72,11 @@ Flag::set_font_description (Pango::FontDescription font_description)
void
Flag::set_text (string const & text)
{
- _text->set (text);
+ if (text.empty ()) {
+ _text->set (" ");
+ } else {
+ _text->set (text);
+ }
boost::optional<Rect> bbox = _text->bounding_box ();
assert (bbox);