Merge pull request #641 from Subsurface-divelog/taxonomyCrashFix

Taxonomy crash fix
This commit is contained in:
Subsurface 2017-10-05 22:27:02 -07:00 committed by GitHub
commit 30be43c311

View file

@ -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;