Check that view exists before calling post_create method

Avoids 'NoneType' object has no attribute 'post_create' error.

Fixes #12638
This commit is contained in:
SNoiraud 2022-06-08 08:38:20 +02:00 committed by Nick Hall
parent 9e81014fc6
commit 0a981f0ca6

View File

@ -842,7 +842,8 @@ class ViewManager(CLIManager):
hbox.add(Gtk.Label(label=pdata.name))
hbox.show_all()
page_num = self.notebook.append_page(page.get_display(), hbox)
self.active_page.post_create()
if self.active_page:
self.active_page.post_create()
if not self.file_loaded:
self.uimanager.set_actions_visible(self.actiongroup, False)
self.uimanager.set_actions_visible(self.readonlygroup, False)