When removing o2 from a gas, eg setting it to "", air, this code would
raise a nice fpe. Fix that by using gas_mod instead.

Signed-off-by: Anton Lundin <gla...@acc.umu.se>
---
 qt-ui/models.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index dc9a718..2bc690e 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -253,7 +253,9 @@ bool CylindersModel::setData(const QModelIndex &index, 
const QVariant &value, in
        case O2:
                if (CHANGED()) {
                        cyl->gasmix.o2 = 
string_to_fraction(vString.toUtf8().data());
-                       cyl->depth.mm = 1600 * 1000 / cyl->gasmix.o2.permille * 
10 - 10000;
+                       pressure_t modppO2;
+                       modppO2.mbar = 1600;
+                       cyl->depth = gas_mod(&cyl->gasmix, modppO2);
                        changed = true;
                }
                break;
-- 
1.9.1

_______________________________________________
subsurface mailing list
subsurface@hohndel.org
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to