summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Subsurface <dirk@subsurface-divelog.org>2017-10-05 22:27:02 -0700
committerGravatar GitHub <noreply@github.com>2017-10-05 22:27:02 -0700
commit30be43c3113102c768d622688ea26ae4f69e2319 (patch)
treee29e020686c7b6b0a61831c9f77c5799d760930a
parent90674cf7f8c2987536a5a93729ea1546acf0fe41 (diff)
parent80e6032f6fd57ea73bc4d7eab48277ec500f02a3 (diff)
downloadsubsurface-30be43c3113102c768d622688ea26ae4f69e2319.tar.gz
Merge pull request #641 from Subsurface-divelog/taxonomyCrashFix
Taxonomy crash fix
-rw-r--r--core/taxonomy.c5
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;