summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui_gtk.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gui_gtk.cc b/src/gui_gtk.cc
index 062ac4c..af67921 100644
--- a/src/gui_gtk.cc
+++ b/src/gui_gtk.cc
@@ -1907,8 +1907,14 @@ void GtkGuiMain::set_package(std::unique_ptr<AttributedText>&& text) {
package_.swap(text);
auto wnd = reinterpret_cast<MainAppWindow*>(window());
if (wnd) {
- gtk_text_view_set_buffer(GTK_TEXT_VIEW(wnd->bottom_),
- static_cast<GtkAttributedText*>(package_.get())->buffer());
+ GtkTextBuffer* buf;
+ if (package_) {
+ buf = static_cast<GtkAttributedText*>(package_.get())->buffer();
+ } else {
+ buf = gtk_text_buffer_new(NULL);
+ }
+ gtk_text_view_set_buffer(GTK_TEXT_VIEW(wnd->bottom_), buf);
+ if (!package_) g_object_unref(buf);
}
}