From cb53049b7495398969d45925f7823fd7588e8126 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 17 Mar 2014 20:41:16 -0700 Subject: Don't devide by 0 if fO2 is 100% Fixes #465 Initial-patch-by: Anton Lundin Better-idea-by: Linus Torvalds Signed-off-by: Dirk Hohndel --- profile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profile.c b/profile.c index 2102179f2..58a29d9c4 100644 --- a/profile.c +++ b/profile.c @@ -1130,7 +1130,7 @@ static void calculate_gas_information_new(struct dive *dive, struct plot_info *p amb_pressure = depth_to_mbar(entry->depth, dive) / 1000.0; fo2 = get_o2(&dive->cylinder[cylinderindex].gasmix); fhe = get_he(&dive->cylinder[cylinderindex].gasmix); - double ratio = (double)fhe / (1000.0 - fo2); + double ratio = (fo2 == 1000) ? 0 : (double)fhe / (1000.0 - fo2); if (entry->po2) { /* we have an O2 partial pressure in the sample - so this -- cgit v1.2.3-70-g09d2