Skip to content

Commit

Permalink
prevents access to the history state if not set (#12436)
Browse files Browse the repository at this point in the history
  • Loading branch information
martrapp authored Nov 15, 2024
1 parent e64ec5f commit 453ec6b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/dirty-teachers-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes a potential null access in the clientside router
2 changes: 1 addition & 1 deletion packages/astro/src/transitions/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ if (inBrowser) {
'scroll',
() => {
if (intervalId !== undefined) return;
(lastIndex = history.state.index), (lastY = scrollY), (lastX = scrollX);
(lastIndex = history.state?.index), (lastY = scrollY), (lastX = scrollX);
intervalId = window.setInterval(scrollInterval, 50);
},
{ passive: true },
Expand Down

0 comments on commit 453ec6b

Please sign in to comment.