diff options
-rw-r--r-- | core/divesitehelpers.cpp | 8 | ||||
-rw-r--r-- | desktop-widgets/modeldelegates.cpp | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/core/divesitehelpers.cpp b/core/divesitehelpers.cpp index cdc4bcdc3..bb4764274 100644 --- a/core/divesitehelpers.cpp +++ b/core/divesitehelpers.cpp @@ -114,13 +114,13 @@ taxonomy_data reverseGeoLookup(degrees_t latitude, degrees_t longitude) taxonomy_set_category(&taxonomy, (taxonomy_category)idx, qPrintable(value), taxonomy_origin::GEOCODED); } } - int l3 = taxonomy_index_for_category(&taxonomy, TC_ADMIN_L3); - int lt = taxonomy_index_for_category(&taxonomy, TC_LOCALNAME); - if (l3 == -1 && lt != -1) { + const char *l3 = taxonomy_get_value(&taxonomy, TC_ADMIN_L3); + const char *lt = taxonomy_get_value(&taxonomy, TC_LOCALNAME); + if (empty_string(l3) && !empty_string(lt)) { // basically this means we did get a local name (what we call town), but just like most places // we didn't get an adminName_3 - which in some regions is the actual city that town belongs to, // then we copy the town into the city - taxonomy_set_category(&taxonomy, TC_ADMIN_L3, taxonomy.category[lt].value, taxonomy_origin::GEOCOPIED); + taxonomy_set_category(&taxonomy, TC_ADMIN_L3, lt, taxonomy_origin::GEOCOPIED); } } else { report_error("geonames.org did not provide reverse lookup information"); diff --git a/desktop-widgets/modeldelegates.cpp b/desktop-widgets/modeldelegates.cpp index 093a25a43..94162fd8f 100644 --- a/desktop-widgets/modeldelegates.cpp +++ b/desktop-widgets/modeldelegates.cpp @@ -404,12 +404,12 @@ void LocationFilterDelegate::paint(QPainter *painter, const QStyleOptionViewItem for (int i = 0; i < 3; i++) { if (prefs.geocoding.category[i] == TC_NONE) continue; - int idx = taxonomy_index_for_category(&ds->taxonomy, prefs.geocoding.category[i]); - if (idx == -1) + const char *value = taxonomy_get_value(&ds->taxonomy, prefs.geocoding.category[i]); + if (empty_string(value)) continue; if(!bottomText.isEmpty()) bottomText += " / "; - bottomText += QString(ds->taxonomy.category[idx].value); + bottomText += QString(value); } if (bottomText.isEmpty()) |