From 8b7ab45c738e5127f7ad191440dfdfff1379c958 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Thu, 22 Jul 2021 09:49:24 +0200 Subject: [PATCH] Handle missing item in find nearby OSM API call --- web_view.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web_view.py b/web_view.py index 96b9cb0..2120104 100755 --- a/web_view.py +++ b/web_view.py @@ -348,6 +348,11 @@ def api_find_osm_candidates(item_id): t0 = time() bounds = read_bounds_param() item = model.Item.query.get(item_id) + if not item: + return cors_jsonify(success=True, + qid=f'Q{item_id}', + error="item doesn't exist") + nearby = api.find_osm_candidates(item, bounds) t1 = time() - t0