Better invalid dive site name

This should ensure that no one ever might end up with our "invalid" name
for real. And it allows us to more easily test elsewhere for that invalid
value.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-07-17 08:39:49 -07:00
parent c78e4fb92d
commit 2a4cacda21
2 changed files with 5 additions and 2 deletions

View file

@ -63,6 +63,8 @@ void clear_dive_site(struct dive_site *ds);
unsigned int get_distance(degrees_t lat1, degrees_t lon1, degrees_t lat2, degrees_t lon2);
uint32_t find_or_create_dive_site_with_name(const char *name);
#define INVALID_DIVE_SITE_NAME "development use only - not a valid dive site name"
#ifdef __cplusplus
}
#endif

View file

@ -69,9 +69,10 @@ QVariant LocationInformationModel::data(const QModelIndex &index, int role) cons
if (index.row() == 1) {
struct dive_site *ds = get_dive_site_name_start_which_str(textField->text());
if (!ds)
return "NOT HERE";
return INVALID_DIVE_SITE_NAME;
if (QString(ds->name) == textField->text())
return "NOT HERE";
return INVALID_DIVE_SITE_NAME;
}
return textField->text();
}