Skip to content

Commit

Permalink
fixed findMinFromSorted when list is null (#1918)
Browse files Browse the repository at this point in the history
  • Loading branch information
igorDykhta committed Aug 10, 2022
1 parent 3a3be58 commit d358b3a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/layers/src/trip-layer/trip-utils.ts
Expand Up @@ -144,8 +144,9 @@ export function parseTripGeoJsonTimestamp(dataToFeature: any[]) {
return {dataToTimeStamp, animationDomain};
}

function findMinFromSorted(list: number[] = []) {
return list.find(d => notNullorUndefined(d) && Number.isFinite(d)) || null;
function findMinFromSorted(list: number[]) {
// check if list is null since the default value [] will only be applied when the param is undefined
return list?.find(d => notNullorUndefined(d) && Number.isFinite(d)) || null;
}

function findMaxFromSorted(list: number[] = []) {
Expand Down

0 comments on commit d358b3a

Please sign in to comment.