diff --git a/tradecalc.py b/tradecalc.py index a16f020b..360dca7c 100644 --- a/tradecalc.py +++ b/tradecalc.py @@ -370,7 +370,9 @@ def getBestTrade(self, src, dst, credits=None, fitFunction=None): 'fitFunction' lets you specify a function to use for performing the fit. """ tdenv = self.tdenv - if credits is None: credits = tdenv.credits - getattr(tdenv, 'insurance', 0) + if credits is None: + credits = getattr(tdenv, 'credits', 0) or 0 + credits -= (getattr(tdenv, 'insurance', 0) or 0) capacity = tdenv.capacity avoidItems = tdenv.avoidItems tdenv.DEBUG0("{}/{} -> {}/{} with {:n}cr",