Changeset 8d42d33 in subsurface


Ignore:
Timestamp:
May 29, 2017, 8:57:04 AM (3 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
88738ede
Parents:
3f0d210
git-author:
Jan Mulder <jlmulder@…> (05/28/17 05:02:26)
git-committer:
Dirk Hohndel <dirk@…> (05/29/17 08:57:04)
Message:

mobile: Prevent tripping assert on empty BT download

When (with mobile on desktop) loading from DC is called and the dive computer
to connect to is not in download mode, the repopulate() function is called
with an empty dive table. This trips the assert (obviously, debug compile only) in
DiveImportedModel::setImportedDivesIndexes(). This simple fix makes things just
more robust.

Signed-off-by: Jan Mulder <jlmulder@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • qt-models/diveimportedmodel.cpp

    r3f0d210 r8d42d33  
    141141void DiveImportedModel::repopulate()
    142142{
    143         setImportedDivesIndexes(0, diveTable->nr-1);
     143        if (diveTable->nr)
     144                setImportedDivesIndexes(0, diveTable->nr-1);
     145        else
     146                setImportedDivesIndexes(0, 0);
    144147}
    145148
Note: See TracChangeset for help on using the changeset viewer.