mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
fix site/location build issue
We were assuming these tables were sorted with their indexes, but it happens to be false, under some circustances at least. Reported-by: Andreas Hagberg <scubasoft@gmail.com> Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
This commit is contained in:
parent
6e4c3ce6d8
commit
218567bb86
1 changed files with 5 additions and 2 deletions
|
@ -334,8 +334,9 @@ static void smtk_build_location(MdbHandle *mdb, char *idx, struct dive_site **lo
|
|||
if (!table)
|
||||
return;
|
||||
|
||||
for (i = 1; i <= atoi(idx); i++)
|
||||
do {
|
||||
mdb_fetch_row(table);
|
||||
} while (strcasecmp(col[0]->bind_ptr, idx));
|
||||
loc_idx = copy_string(col[2]->bind_ptr);
|
||||
site = copy_string(col[1]->bind_ptr);
|
||||
loc = create_location(strtod(col[6]->bind_ptr, NULL), strtod(col[7]->bind_ptr, NULL));
|
||||
|
@ -360,8 +361,10 @@ static void smtk_build_location(MdbHandle *mdb, char *idx, struct dive_site **lo
|
|||
/* Read data from Location table, linked to Site by loc_idx */
|
||||
table = smtk_open_table(mdb, "Location", col, bound_values);
|
||||
mdb_rewind_table(table);
|
||||
for (i = 1; i <= atoi(loc_idx); i++)
|
||||
do {
|
||||
mdb_fetch_row(table);
|
||||
} while (strcasecmp(col[0]->bind_ptr, loc_idx));
|
||||
|
||||
/*
|
||||
* Create a string for Subsurface's dive site structure with coordinates
|
||||
* if available, if the site's name doesn't previously exists.
|
||||
|
|
Loading…
Reference in a new issue