Skip to content

Commit

Permalink
Handle case when no missing index is found
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-sweet committed Jan 31, 2024
1 parent c95fffc commit ddabc14
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/scene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,10 @@ async function fetchPointsAtTime(array: ZarrArray, timeIndex: number): Promise<F
// this is how the jagged array is stored in the zarr
// for Float32 it's actually -9999, but the int8 data is -127
let endIndex = points.findIndex((value) => value <= -127);
if (endIndex % 3 !== 0) {
console.error("invalid points - not divisible by 3");
if (endIndex === -1) {
endIndex = points.length;
} else if (endIndex % 3 !== 0) {
console.error("invalid points - %d not divisible by 3", endIndex);
endIndex -= endIndex % 3;
}
return points.subarray(0, endIndex);
Expand Down

0 comments on commit ddabc14

Please sign in to comment.