summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-04-21 08:59:33 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-04-21 07:50:38 -0700
commita8aa8971176239fa4d428aaa4599d1f996e11885 (patch)
tree15c79f9a17de53b40e8c211588208fb44f55ccd1 /qt-models
parent4aebcdc021391fcbdee089b5e14c11ebab517885 (diff)
downloadsubsurface-a8aa8971176239fa4d428aaa4599d1f996e11885.tar.gz
desktop: don't access first data element if no cylinders
TabDiveInformation::updateProfile() does some statistics via the per_cylinder_mean_depth function. It passes down arrays with one entry per cylinder, which are allocated by means std::vector. To pass the array, the expression "&vector[0]" is used. It seems like some compilers through an assertion violation if vector has no elements. They are technically correct in that this is undefined, but still this appears like very unfriendly behavior. After all, std::vector should behave just like a dynamic C-array that is automatically freed, when going out of scope. Replace the "&vector[0]" by "vector.data()" and don't do the call if there aren't any cylinders for good measure. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models')
0 files changed, 0 insertions, 0 deletions