Skip to content

Commit

Permalink
fixed the errors we get when the logs are over (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
saturnaliam authored Apr 14, 2024
1 parent 1cf6bc6 commit 0865710
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ts/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ function initialize(data: object[]) {
// Drawing function for Field2D
draw = () => {
const item = data[i];

if (i >= data.length || item == undefined) {
playing = false;
return;
}

const robotX = Number(item["Robot X"]);
const robotY = Number(item["Robot Y"]);
const robotRotation = degreesToRadians(Number(item["Robot Theta (deg)"]));
Expand Down

0 comments on commit 0865710

Please sign in to comment.