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 <gla...@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

_______________________________________________
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to