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.
This commit is contained in:
Robert Fewell
2024-10-21 12:23:07 +01:00
parent 29ec4257db
commit 6912c49ae0

View File

@@ -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;
}