summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-03 16:06:00 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-03 16:06:00 -0800
commitccfea0872d9bc1c3969197f089b2b2a8f03f09fc (patch)
tree45d47c71ccd231249cde4f641b2b6562405903a4
parent5cc261311ec1649440ff9e4db8ff9e3229f167b6 (diff)
downloadsubsurface-ccfea0872d9bc1c3969197f089b2b2a8f03f09fc.tar.gz
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>
-rw-r--r--qt-ui/maintab.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 2b23bd5da..efbd3bc20 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -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);
}