Skip to content

Commit

Permalink
chore: paranoid check to prevent runtime exception with stackrabbit r…
Browse files Browse the repository at this point in the history
…ecommendations
  • Loading branch information
timotheeg committed Jan 5, 2025
1 parent d14e095 commit cc87efe
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions public/views/addStackRabbitRecommendation.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ export default function addStackRabbitRecommendation(
const [rotation, xshift, yshift] = placement;
const field_copy = [...field];
const shape = ROTATIONS[piece][rotation];

if (!shape) {
// should not happen but paranoid check
console.warn(
`Unexpected recommendation rotation found: (${piece}, ${rotation}) with placement data [${placement}]`
);
return field_copy;
}

const offset_x = OFFSET_X + xshift;
const offset_y = OFFSET_Y + yshift;

Expand Down

0 comments on commit cc87efe

Please sign in to comment.