Don't leak a GNCPrice after fetching prices from finance-quote.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22644 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Mike Alexander 2012-12-13 05:13:34 +00:00
parent 1116226aaa
commit 366411853d

View File

@ -1680,11 +1680,15 @@ gnc_xfer_dialog_fetch (GtkButton *button, XferDialog *xferData)
scm_call_2 (quotes_func, scm_window, book_scm);
gnc_unset_busy_cursor (NULL);
/*the results should be in the price db now */
/*the results should be in the price db now, but don't crash if not. */
prc = gnc_pricedb_lookup_latest(xferData->pricedb, from, to);
rate = gnc_price_get_value (prc);
gnc_amount_edit_set_amount(GNC_AMOUNT_EDIT(xferData->price_edit), rate);
if (prc)
{
rate = gnc_price_get_value (prc);
gnc_amount_edit_set_amount(GNC_AMOUNT_EDIT(xferData->price_edit), rate);
gnc_price_unref (prc);
}
LEAVE("quote retrieved");