Start editing new site regardless what the user does first

It doesn't matter if we first enter coordinates, name, description or
notes. If there is no currentDs we need to handle that gracefully.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-05-27 06:36:19 -07:00
parent bfee0a13f0
commit d6e32b02f6

View file

@ -242,13 +242,13 @@ void LocationInformationWidget::on_diveSiteCoordinates_textChanged(const QString
void LocationInformationWidget::on_diveSiteDescription_textChanged(const QString& text)
{
if (!same_string(qPrintable(text), currentDs->description))
if (!currentDs || !same_string(qPrintable(text), currentDs->description))
markChangedWidget(ui.diveSiteDescription);
}
void LocationInformationWidget::on_diveSiteName_textChanged(const QString& text)
{
if (!same_string(qPrintable(text), currentDs->name)) {
if (!currentDs || !same_string(qPrintable(text), currentDs->name)) {
free(displayed_dive_site.name);
displayed_dive_site.name = copy_string(qPrintable(text));
markChangedWidget(ui.diveSiteName);
@ -258,7 +258,7 @@ void LocationInformationWidget::on_diveSiteName_textChanged(const QString& text)
void LocationInformationWidget::on_diveSiteNotes_textChanged()
{
if (!same_string(qPrintable(ui.diveSiteNotes->toPlainText()), currentDs->notes))
if (! currentDs || !same_string(qPrintable(ui.diveSiteNotes->toPlainText()), currentDs->notes))
markChangedWidget(ui.diveSiteNotes);
}