[geocode-glib/wip/hadess/place_rank-crasher: 2/3] geocode-nominatim: Fix possible crash with missing place_rank
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geocode-glib/wip/hadess/place_rank-crasher: 2/3] geocode-nominatim: Fix possible crash with missing place_rank
- Date: Thu, 14 Mar 2019 00:38:01 +0000 (UTC)
commit 7d9da66854e4e878d53bd60fa35017b9fbea008b
Author: Bastien Nocera <hadess hadess net>
Date: Thu Mar 14 01:23:19 2019 +0100
geocode-nominatim: Fix possible crash with missing place_rank
Spotted by Ordissimo <thierry ordissimo com>
geocode-glib/geocode-nominatim.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/geocode-glib/geocode-nominatim.c b/geocode-glib/geocode-nominatim.c
index b2abc97..fc333dc 100644
--- a/geocode-glib/geocode-nominatim.c
+++ b/geocode-glib/geocode-nominatim.c
@@ -390,9 +390,11 @@ get_place_type_from_attributes (GHashTable *ht)
place_type = GEOCODE_PLACE_TYPE_DRAINAGE;
} else if (g_strcmp0 (category, "boundary") == 0) {
if (g_strcmp0 (type, "administrative") == 0) {
+ const char *place_rank;
int rank;
- rank = atoi (g_hash_table_lookup (ht, "place_rank"));
+ place_rank = g_hash_table_lookup (ht, "place_rank");
+ rank = place_rank ? atoi (place_rank) : 0;
if (rank < 2)
place_type = GEOCODE_PLACE_TYPE_UNKNOWN;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]