mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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@xs4all.nl>
This commit is contained in:
parent
3f0d21046e
commit
8d42d33f93
1 changed files with 4 additions and 1 deletions
|
@ -140,7 +140,10 @@ void DiveImportedModel::setImportedDivesIndexes(int first, int last)
|
|||
|
||||
void DiveImportedModel::repopulate()
|
||||
{
|
||||
setImportedDivesIndexes(0, diveTable->nr-1);
|
||||
if (diveTable->nr)
|
||||
setImportedDivesIndexes(0, diveTable->nr-1);
|
||||
else
|
||||
setImportedDivesIndexes(0, 0);
|
||||
}
|
||||
|
||||
void DiveImportedModel::recordDives()
|
||||
|
|
Loading…
Reference in a new issue