diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2017-10-05 15:40:19 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-10-05 15:42:46 -0700 |
commit | 80e6032f6fd57ea73bc4d7eab48277ec500f02a3 (patch) | |
tree | 5e5b3b37b503a38e8affcb3ae90e2ba0b1875111 /core | |
parent | 3487612337ef0308e3f2129a3193a0f65ac9691c (diff) | |
download | subsurface-80e6032f6fd57ea73bc4d7eab48277ec500f02a3.tar.gz |
Prevent crash when adding country to dive site
We need to make sure that the taxonomy information has been allocated
before assigning values to it...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/taxonomy.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/core/taxonomy.c b/core/taxonomy.c index a6d829fa1..8776862d6 100644 --- a/core/taxonomy.c +++ b/core/taxonomy.c @@ -61,6 +61,11 @@ const char *taxonomy_get_country(struct taxonomy_data *t) void taxonomy_set_country(struct taxonomy_data *t, const char *country, enum taxonomy_origin origin) { int idx = -1; + + // make sure we have taxonomy data allocated + if (!t->category) + t->category = alloc_taxonomy(); + for (int i = 0; i < t->nr; i++) { if (t->category[i].category == TC_COUNTRY) { idx = i; |