Fix crash in gnc_owner_get_owner

If there are no owners gnc_general_search_get_selected
returns nullptr without showing the dialog.
This commit is contained in:
John Ralls 2023-03-24 12:38:23 -07:00
parent 03bca6023c
commit fc41a51f57

View File

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