Fix crash with empty patch-names.
authorRobin Gareus <robin@gareus.org>
Sat, 29 Oct 2016 01:13:59 +0000 (03:13 +0200)
committerRobin Gareus <robin@gareus.org>
Sat, 29 Oct 2016 17:57:43 +0000 (19:57 +0200)
An empty text will not produce a bounding box.

libs/canvas/flag.cc

index 2d0bdb28305bb764a6215a60977c5627da8eff92..d0ce5af2b13c582218368e19aa61cb58f6dcfd6e 100644 (file)
@@ -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);