mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix crash when no dives were selected for downloading
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
d5d42982b8
commit
6edc458e83
1 changed files with 16 additions and 10 deletions
|
@ -418,6 +418,8 @@ void DownloadFromDCWidget::on_cancel_clicked()
|
||||||
|
|
||||||
void DownloadFromDCWidget::on_ok_clicked()
|
void DownloadFromDCWidget::on_ok_clicked()
|
||||||
{
|
{
|
||||||
|
struct dive *dive;
|
||||||
|
|
||||||
if (currentState != DONE)
|
if (currentState != DONE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -433,6 +435,9 @@ void DownloadFromDCWidget::on_ok_clicked()
|
||||||
// remember the last downloaded dive (on most dive computers this will be the chronologically
|
// remember the last downloaded dive (on most dive computers this will be the chronologically
|
||||||
// first new dive) and select it again after processing all the dives
|
// first new dive) and select it again after processing all the dives
|
||||||
MainWindow::instance()->dive_list()->unselectDives();
|
MainWindow::instance()->dive_list()->unselectDives();
|
||||||
|
|
||||||
|
dive = get_dive(dive_table.nr - 1);
|
||||||
|
if (dive != NULL) {
|
||||||
uniqId = get_dive(dive_table.nr - 1)->id;
|
uniqId = get_dive(dive_table.nr - 1)->id;
|
||||||
process_dives(true, preferDownloaded());
|
process_dives(true, preferDownloaded());
|
||||||
// after process_dives does any merging or resorting needed, we need
|
// after process_dives does any merging or resorting needed, we need
|
||||||
|
@ -443,6 +448,7 @@ void DownloadFromDCWidget::on_ok_clicked()
|
||||||
// (but not visible as selected)
|
// (but not visible as selected)
|
||||||
MainWindow::instance()->dive_list()->unselectDives();
|
MainWindow::instance()->dive_list()->unselectDives();
|
||||||
MainWindow::instance()->dive_list()->selectDive(idx, true);
|
MainWindow::instance()->dive_list()->selectDive(idx, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (ostcFirmwareCheck && currentState == DONE)
|
if (ostcFirmwareCheck && currentState == DONE)
|
||||||
ostcFirmwareCheck->checkLatest(this, &data);
|
ostcFirmwareCheck->checkLatest(this, &data);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue