Skip to content

Commit

Permalink
fix(grid): zero length grid cell bounds (#6536)
Browse files Browse the repository at this point in the history
**Problem:**
no gaps cause a null pointer exception

**Fix:**
check for array length and not just a null check.

**Manual Tests:**
I hereby swear that:

- [X] I opened a hydrogen project and it loaded
- [X] I could navigate to various routes in Play mode
  • Loading branch information
liady committed Dec 13, 2024
1 parent 053517a commit eedeba6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion editor/src/components/canvas/gap-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export function gridGapControlBoundsFromMetadata(

const gridCellBounds = grid.specialSizeMeasurements.gridCellGlobalFrames

if (gridCellBounds == null) {
if (gridCellBounds == null || gridCellBounds.length == 0) {
return emptyResult
}
const allCellsBound = canvasRectangle({
Expand Down

0 comments on commit eedeba6

Please sign in to comment.