mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-23 09:26:27 -06:00
Fix crash in invoice payment introduced in commit 21181
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21185 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
1b7bd7b3e9
commit
5e02450258
@ -326,6 +326,16 @@ qofOwnerSetEntity (GncOwner *owner, QofInstance *ent)
|
||||
}
|
||||
}
|
||||
|
||||
gboolean GNC_IS_OWNER (QofInstance *ent)
|
||||
{
|
||||
if (!ent)
|
||||
return FALSE;
|
||||
|
||||
return (GNC_IS_VENDOR(ent) ||
|
||||
GNC_IS_CUSTOMER(ent) ||
|
||||
GNC_IS_EMPLOYEE(ent) ||
|
||||
GNC_IS_JOB(ent));
|
||||
}
|
||||
gpointer gncOwnerGetUndefined (const GncOwner *owner)
|
||||
{
|
||||
if (!owner) return NULL;
|
||||
@ -944,7 +954,7 @@ gncOwnerApplyPayment (GncOwner *owner, GncInvoice* invoice,
|
||||
/* Now send an event for the invoice so it gets updated as paid */
|
||||
this_invoice = gncInvoiceGetInvoiceFromLot(lot);
|
||||
if (this_invoice)
|
||||
qof_event_gen (QOF_INSTANCE(&this_invoice), QOF_EVENT_MODIFY, NULL);
|
||||
qof_event_gen (QOF_INSTANCE(this_invoice), QOF_EVENT_MODIFY, NULL);
|
||||
|
||||
if (gnc_numeric_zero_p (payment_value))
|
||||
break;
|
||||
|
@ -69,6 +69,10 @@ QofIdTypeConst qofOwnerGetType(const GncOwner *owner);
|
||||
QofInstance* qofOwnerGetOwner (const GncOwner *owner);
|
||||
/** set the owner from the entity. */
|
||||
void qofOwnerSetEntity (GncOwner *owner, QofInstance *ent);
|
||||
/** Check if entity is an owner kind. This function conveniently
|
||||
* imitates the various GNC_IS_ checks on the other gnucash
|
||||
* objects even though an owner is not really a true object. */
|
||||
gboolean GNC_IS_OWNER (QofInstance *ent);
|
||||
|
||||
/** Returns the QofIdType of the given GncOwnerType, or NULL if no
|
||||
* suitable one exists. */
|
||||
|
@ -993,7 +993,7 @@ gnc_tree_model_owner_event_handler (QofInstance *entity,
|
||||
|
||||
g_return_if_fail(model); /* Required */
|
||||
|
||||
if (!entity)
|
||||
if (!GNC_IS_OWNER(entity))
|
||||
return;
|
||||
|
||||
ENTER("entity %p of type %d, model %p, event_data %p",
|
||||
|
Loading…
Reference in New Issue
Block a user