mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive site management: make sure currentDs is valid
When double clicking on the globe on a dive with no dive site we did almost the right thing - except that we didn't create a dive site. Not 100% sure this is the right place to do this, but it seems to work and prevents the crash. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
c6783739c9
commit
bfee0a13f0
1 changed files with 5 additions and 1 deletions
|
@ -219,13 +219,17 @@ void LocationInformationWidget::enableEdition()
|
|||
ui.diveSiteMessage->addAction(acceptAction);
|
||||
ui.diveSiteMessage->addAction(rejectAction);
|
||||
ui.diveSiteMessage->setCloseButtonVisible(false);
|
||||
if (!currentDs) {
|
||||
displayed_dive.dive_site_uuid = create_dive_site(NULL);
|
||||
currentDs = get_dive_site_by_uuid(displayed_dive.dive_site_uuid);
|
||||
}
|
||||
}
|
||||
|
||||
extern bool parseGpsText(const QString &gps_text, double *latitude, double *longitude);
|
||||
|
||||
void LocationInformationWidget::on_diveSiteCoordinates_textChanged(const QString& text)
|
||||
{
|
||||
if (!same_string(qPrintable(text), printGPSCoords(currentDs->latitude.udeg, currentDs->longitude.udeg))) {
|
||||
if (!currentDs || !same_string(qPrintable(text), printGPSCoords(currentDs->latitude.udeg, currentDs->longitude.udeg))) {
|
||||
double latitude, longitude;
|
||||
if (parseGpsText(text, &latitude, &longitude)) {
|
||||
displayed_dive_site.latitude.udeg = latitude * 1000000;
|
||||
|
|
Loading…
Add table
Reference in a new issue