Browse Source

[fixed] Protection for potential divide by zero

Kevin_Smarts 9 months ago
parent
commit
4e3d48cf1a
1 changed files with 1 additions and 1 deletions
  1. 1 1
      locations/lact_lib.qsrc

+ 1 - 1
locations/lact_lib.qsrc

@@ -602,7 +602,7 @@ if $ARGS[0] = 'breastcycle':
 			!!	funny parabelfunction for the lactrategrowth > 65 - ((1/1466)*((lactrate-304)*(lactrate-304)))
 
 			lactation['prolactinlvl'] += (lactation['dailyoverdemand']/10000)
-			if lactation['dailyoverdemand'] > 0 and lactation['breastpumped'] >= 0:
+			if lactation['dailyoverdemand'] > 0 and lactation['breastpumped'] >= 0 and lactation['lactaterate'] ! 0:
 				!!  adding cap
 				if (lactation['breastmm'] / lactation['lactaterate']) > lactation['caplactaterate']:		
 					lactation['max_lactrate_growth'] = (65 - ((((lactation['lactaterate']/1000) - 304)*((lactation['lactaterate']/1000) - 304))/1466))*1000