Fixes possible molar ratio runtime (#36695)

This commit is contained in:
SECBATON GRIFFON
2024-06-25 15:56:58 +01:00
committed by GitHub
parent f51cf588a6
commit cc493e08ee

View File

@@ -132,7 +132,7 @@
return temperature * heat_capacity()
/datum/gas_mixture/proc/molar_ratio(g) //ratio of moles of the input gas to total mols of all gasses in the area
return src[g] / total_moles
return total_moles && (src[g] / total_moles) //&& short circuits if total_moles is 0, and returns the second expression if it is not.
/datum/gas_mixture/proc/molar_density(g) //Per liter. You should probably be using pressure instead, but considering this had to be made, you wouldn't be the first not to.
return (g ? src[g] : total_moles) / volume