Commit dbe1af0a authored by Michael Auer's avatar Michael Auer
Browse files

fix issue with undefined properties in case of empty ohsome result

parent 4d6fd447
......@@ -206,12 +206,12 @@ export class GeoJsonFeatureType extends FeatureType {
// JSON Response
// check isContributionView
const hasFromTimestamps = ohsomeResults.groupByResult[0].result[0].fromTimestamp !== undefined;
const hasToTimestamps = ohsomeResults.groupByResult[0].result[0].toTimestamp !== undefined;
const hasFromTimestamps = ohsomeResults.groupByResult?.[0]?.result?.[0]?.fromTimestamp !== undefined;
const hasToTimestamps = ohsomeResults.groupByResult?.[0]?.result?.[0]?.toTimestamp !== undefined;
isContributionView = hasFromTimestamps && hasToTimestamps;
// check isRatio
isRatio = ohsomeResults.groupByResult[0].result[0].ratio !== undefined;
isRatio = ohsomeResults.groupByResult?.[0]?.result?.[0]?.ratio !== undefined;
}
......
......@@ -597,12 +597,12 @@ class Ohsome2X extends EventEmitter {
//JSON Response
// check isContributionView
const hasFromTimestamps = ohsomeGroupByBoundaryResponse.groupByResult[0].result[0].fromTimestamp !== undefined;
const hasToTimestamps = ohsomeGroupByBoundaryResponse.groupByResult[0].result[0].toTimestamp !== undefined;
const hasFromTimestamps = ohsomeGroupByBoundaryResponse.groupByResult?.[0]?.result?.[0]?.fromTimestamp !== undefined;
const hasToTimestamps = ohsomeGroupByBoundaryResponse.groupByResult?.[0]?.result?.[0]?.toTimestamp !== undefined;
isContributionView = hasFromTimestamps && hasToTimestamps;
// check isRatio
isRatio = ohsomeGroupByBoundaryResponse.groupByResult[0].result[0].ratio !== undefined;
isRatio = ohsomeGroupByBoundaryResponse.groupByResult?.[0]?.result?.[0]?.ratio !== undefined;
}
// return isContributionView;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment