Check for a duplicate price in add_price before adding it to the list instead of after.

pull/39/head
Mike Alexander 11 years ago
parent c7f87f253b
commit 60ae86d178

@ -1109,6 +1109,12 @@ add_price(GNCPriceDB *db, GNCPrice *p)
return FALSE;
}
if (!insert_or_replace_price(db, p))
{
LEAVE("A better price already exists");
return FALSE;
}
currency_hash = g_hash_table_lookup(db->commodity_hash, commodity);
if (!currency_hash)
{
@ -1128,11 +1134,6 @@ add_price(GNCPriceDB *db, GNCPrice *p)
return FALSE;
}
if (!insert_or_replace_price(db, p))
{
LEAVE("A better price already exists");
return FALSE;
}
g_hash_table_insert(currency_hash, currency, price_list);
p->db = db;
qof_event_gen (&p->inst, QOF_EVENT_ADD, NULL);

Loading…
Cancel
Save