Skip to content

Commit cc11aa0

Browse files
committed
handle invalid table reference when creating report
Refs MerginMaps/qgis-plugin#362
1 parent 54aaf8a commit cc11aa0

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

mergin/report.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,16 @@ def changeset_report(changeset_reader, schema):
156156
# let's iterate through reader and populate entries
157157
for entry in changeset_reader:
158158
schema_table = next((t for t in schema if t["table"] == entry.table.name), None)
159-
# get geometry index in both gpkg schema and diffs values
160-
geom_idx = next((index for (index, col) in enumerate(schema_table["columns"]) if col["type"] == "geometry"),
161-
None)
162-
if geom_idx is None:
163-
continue
164-
165-
geom_col = schema_table["columns"][geom_idx]["geometry"]
166-
report_entry = ChangesetReportEntry(entry, geom_idx, geom_col, distance_area)
167-
entries.append(report_entry)
159+
if schema_table:
160+
# get geometry index in both gpkg schema and diffs values
161+
geom_idx = next((index for (index, col) in enumerate(schema_table["columns"]) if col["type"] == "geometry"),
162+
None)
163+
if geom_idx is None:
164+
continue
165+
166+
geom_col = schema_table["columns"][geom_idx]["geometry"]
167+
report_entry = ChangesetReportEntry(entry, geom_idx, geom_col, distance_area)
168+
entries.append(report_entry)
168169

169170
# create a map of entries grouped by tables within single .gpkg file
170171
tables = defaultdict(list)

0 commit comments

Comments
 (0)