[PATCH] Don't put empty strings in buddy/divemaster
Anton Lundin
glance at acc.umu.se
Fri Jun 26 14:50:19 PDT 2015
We store no value as a NULL, so we can omit that value from the xml and
git files.
This ensures the tag-diffing-thingie doesn't produce empty strings for
no value instead of NULL values.
Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
qt-ui/maintab.cpp | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index c6660fc..5569c2d 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -1214,7 +1214,10 @@ void MainTab::saveTaggedStrings()
}
}
free(mydive->buddy);
- mydive->buddy = copy_string(qPrintable(newString));
+ if (newString == "")
+ mydive->buddy = NULL;
+ else
+ mydive->buddy = copy_string(qPrintable(newString));
);
addedList.clear();
removedList.clear();
@@ -1236,7 +1239,10 @@ void MainTab::saveTaggedStrings()
}
}
free(mydive->divemaster);
- mydive->divemaster = copy_string(qPrintable(newString));
+ if (newString == "")
+ mydive->divemaster = NULL;
+ else
+ mydive->divemaster = copy_string(qPrintable(newString));
);
}
--
2.1.4
More information about the subsurface
mailing list