diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-06-21 21:30:38 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-06-21 21:30:38 -0700 |
commit | c01c35ca0ca2e42f2e2ea6a4d9c6e2b2f49c57d1 (patch) | |
tree | c57d61aed4ff41bb7daeeb301438e7c62a4e7c3f | |
parent | ce1be9c2eb7df515690d4861a5ed3f813b82c076 (diff) | |
download | subsurface-c01c35ca0ca2e42f2e2ea6a4d9c6e2b2f49c57d1.tar.gz |
Cylinder model: fix an obscure case that would access cylinder -1
If we remove a cylidner for a unique gas and that is allowable, then don't
try to copy from cylinder with index same_gas (which is still -1).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-models/cylindermodel.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp index 857381b71..a3ab34513 100644 --- a/qt-models/cylindermodel.cpp +++ b/qt-models/cylindermodel.cpp @@ -345,6 +345,9 @@ void CylindersModel::remove(const QModelIndex &index) } beginRemoveRows(QModelIndex(), index.row(), index.row()); // yah, know, ugly. rows--; + // if we didn't find an identical gas, point same_gas at the index.row() + if (same_gas == -1) + same_gas = index.row(); if (index.row() == 0) { // first gas - we need to make sure that the same gas ends up // as first gas |