diff options
author | Stijn Buys <ingar@osirion.org> | 2009-01-26 22:10:59 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2009-01-26 22:10:59 +0000 |
commit | a23fc212ef40acf1ec9ea364e4773d7eb19c5462 (patch) | |
tree | 026ee33f4b1b2857487176f467996dbc5096520a | |
parent | c99a440e6fb1edf35e280f4df8ba22600e490535 (diff) |
fix NULL pointer segfault
-rw-r--r-- | src/ui/widget.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/ui/widget.cc b/src/ui/widget.cc index ef5d472..15fa10f 100644 --- a/src/ui/widget.cc +++ b/src/ui/widget.cc @@ -171,13 +171,18 @@ void Widget::set_background(bool background) void Widget::set_label(std::string const & label) { - set_label(label.c_str()); + widget_label.assign(label); + aux::to_label(widget_label); } void Widget::set_label(char const *label) { - widget_label.assign(label); - aux::to_label(widget_label); + if (label) { + widget_label.assign(label); + aux::to_label(widget_label); + } else { + widget_label.clear(); + } } void Widget::set_palette(const Palette *palette) |