From 6912c49ae062b196c5e9fbf394bbf2b7a6c58ad4 Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Mon, 21 Oct 2024 12:23:07 +0100 Subject: [PATCH] Errors in trace file if account deleted with open register If an account is deleted with an open register there are multiple errors in trace file due to the register plugin page event handler trying to update the notebook tab contents. Add a test for the ledger display leader being not NULL before trying to update the tab contents. --- gnucash/gnome/gnc-plugin-page-register.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gnucash/gnome/gnc-plugin-page-register.cpp b/gnucash/gnome/gnc-plugin-page-register.cpp index 061339572d..ec9de039a8 100644 --- a/gnucash/gnome/gnc-plugin-page-register.cpp +++ b/gnucash/gnome/gnc-plugin-page-register.cpp @@ -5335,6 +5335,14 @@ gnc_plugin_page_register_event_handler (QofInstance* entity, { if (GNC_IS_MAIN_WINDOW (window)) { + GncPluginPageRegisterPrivate *priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page); + + if (!gnc_ledger_display_leader (priv->ledger)) + { + LEAVE ("account is NULL"); + return; + } + gchar *name = gnc_plugin_page_register_get_tab_name (GNC_PLUGIN_PAGE (page)); main_window_update_page_name (GNC_PLUGIN_PAGE (page), name); @@ -5350,7 +5358,7 @@ gnc_plugin_page_register_event_handler (QofInstance* entity, g_free (name); g_free (long_name); } - LEAVE ("tab name updated"); + LEAVE ("tab contents updated"); return; }