selection: prevent use after free crash

This is hiding a bigger issue in the way changes are propagated through
the code, but it should stop an annoying crash in 5.0 from happening.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2021-03-30 14:03:50 -07:00
parent a6ba598e9a
commit 2fd0cd4ea1

View file

@ -377,6 +377,9 @@ void StatsView::replotIfVisible()
void StatsView::divesSelected(const QVector<dive *> &dives)
{
if (dive_table.nr <= 0)
// there are no dives, don't bother (this can happen during reset, for example)
return;
if (isVisible()) {
for (auto &series: series)
series->divesSelected(dives);