mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
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>
This commit is contained in:
parent
3487612337
commit
80e6032f6f
1 changed files with 5 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue