summaryrefslogtreecommitdiff
path: root/amount.cc
diff options
context:
space:
mode:
Diffstat (limited to 'amount.cc')
-rw-r--r--amount.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/amount.cc b/amount.cc
index 22c3816d..d6724640 100644
--- a/amount.cc
+++ b/amount.cc
@@ -229,19 +229,23 @@ amount * gmp_amount::street(bool get_quotes) const
int max = 10;
while (--max >= 0) {
- if (! amt->commdty()->price) {
+ if (! amt->commdty()->price && ! amt->commdty()->sought) {
if (get_quotes)
get_commodity_price(amt->commdty());
+ amt->commdty()->sought = true;
if (! amt->commdty()->price)
break;
}
amount * old = amt;
amt = amt->value(amt->commdty()->price);
- delete old;
- if (amt->commdty() == old->commdty())
+ if (amt->commdty() == old->commdty()) {
+ delete old;
break;
+ }
+
+ delete old;
}
return amt;