diff options
Diffstat (limited to 'core/save-xml.c')
-rw-r--r-- | core/save-xml.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/core/save-xml.c b/core/save-xml.c index baebb0ad9..e49e186f4 100644 --- a/core/save-xml.c +++ b/core/save-xml.c @@ -592,18 +592,14 @@ void save_dives_buffer(struct membuffer *b, const bool select_only, bool anonymi /* save the dive sites - to make the output consistent let's sort the table, first */ dive_site_table_sort(); + purge_empty_dive_sites(); put_format(b, "<divesites>\n"); for (i = 0; i < dive_site_table.nr; i++) { int j; struct dive *d; struct dive_site *ds = get_dive_site(i); - if (dive_site_is_empty(ds) || !is_dive_site_used(ds, false)) { - for_each_dive(j, d) { - if (d->dive_site == ds) - d->dive_site = NULL; - } - delete_dive_site(ds); - i--; // since we just deleted that one + if (!is_dive_site_used(ds, false)) { + /* Only write used dive sites */ continue; } else if (ds->name && (strncmp(ds->name, "Auto-created dive", 17) == 0 || |