gnucash master: Fix crash in gnc_owner_get_owner

John Ralls jralls at code.gnucash.org
Fri Mar 24 15:41:41 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/fc41a51f (commit)
	from  https://github.com/Gnucash/gnucash/commit/03bca602 (commit)



commit fc41a51f57d6f6eaca4deca2b371e83b3caed211
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Mar 24 12:38:23 2023 -0700

    Fix crash in gnc_owner_get_owner
    
    If there are no owners gnc_general_search_get_selected
    returns nullptr without showing the dialog.

diff --git a/gnucash/gnome/business-gnome-utils.c b/gnucash/gnome/business-gnome-utils.c
index 78818a967d..835b22b39f 100644
--- a/gnucash/gnome/business-gnome-utils.c
+++ b/gnucash/gnome/business-gnome-utils.c
@@ -285,6 +285,9 @@ void gnc_owner_get_owner (GtkWidget *widget, GncOwner *owner)
     QofInstance *instance =
         gnc_general_search_get_selected (GNC_GENERAL_SEARCH (widget));
 
+    if (!instance)
+        return;
+
     if (owner->type == GNC_OWNER_NONE ||
         g_strcmp0(instance->e_type, qofOwnerGetType(owner)) == 0)
         qofOwnerSetEntity(owner, instance);



Summary of changes:
 gnucash/gnome/business-gnome-utils.c | 3 +++
 1 file changed, 3 insertions(+)



More information about the gnucash-changes mailing list