forked from MapComplete/MapComplete
UX: attempt to fix #2394
This commit is contained in:
parent
4604fc62e5
commit
156493ef06
6 changed files with 31 additions and 25 deletions
|
|
@ -31,7 +31,7 @@ export abstract class OsmObject {
|
|||
const objects: OsmObject[] = []
|
||||
const allNodes: Map<number, OsmNode> = new Map<number, OsmNode>()
|
||||
|
||||
for (const element of elements) {
|
||||
for (const element of elements ?? []) {
|
||||
const type = element.type
|
||||
const idN = element.id
|
||||
let osmObject: OsmObject = null
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ export default class OsmObjectDownloader {
|
|||
return "deleted"
|
||||
}
|
||||
// A full query might contain more than just the requested object (e.g. nodes that are part of a way, where we only want the way)
|
||||
const parsed = OsmObject.ParseObjects(rawData["content"].elements)
|
||||
const parsed = OsmObject.ParseObjects(rawData?.["content"]?.elements)
|
||||
// Let us fetch the object we need
|
||||
for (const osmObject of parsed) {
|
||||
if (osmObject.type !== type) {
|
||||
|
|
@ -256,6 +256,6 @@ export default class OsmObjectDownloader {
|
|||
// Found the one!
|
||||
return osmObject
|
||||
}
|
||||
throw "PANIC: requested object is not part of the response"
|
||||
throw `PANIC: requested object ${type}/${idN} is not part of the response`
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue