When editing trip data, only copy actual changes

We zero out the displayedTrip and only copy changed data into it; so a
NULL value is not deleted text, it means there was no change.

Fixes #805

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-01-03 16:06:00 -08:00
parent 5cc261311e
commit ccfea0872d

View file

@ -721,11 +721,11 @@ void MainTab::acceptChanges()
amount_selected = 1;
} else if (MainWindow::instance() && MainWindow::instance()->dive_list()->selectedTrips().count() == 1) {
/* now figure out if things have changed */
if (!same_string(displayedTrip.notes, currentTrip->notes)) {
if (displayedTrip.notes && !same_string(displayedTrip.notes, currentTrip->notes)) {
currentTrip->notes = copy_string(displayedTrip.notes);
mark_divelist_changed(true);
}
if (!same_string(displayedTrip.location, currentTrip->location)) {
if (displayedTrip.location && !same_string(displayedTrip.location, currentTrip->location)) {
currentTrip->location = copy_string(displayedTrip.location);
mark_divelist_changed(true);
}