Skip to content

Commit

Permalink
fix: add defense code to check if element exists
Browse files Browse the repository at this point in the history
  • Loading branch information
malangfox committed Aug 30, 2024
1 parent 3763e79 commit 16b1c05
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/renderer/Renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,14 @@ abstract class Renderer {

if (flicking.autoResize && flicking.useResizeObserver) {
panelsAdded.forEach((panel) => {
flicking.autoResizer.observe(panel.element);
if (panel.element) {
flicking.autoResizer.observe(panel.element);
}
});
panelsRemoved.forEach((panel) => {
flicking.autoResizer.unobserve(panel.element);
if (panel.element) {
flicking.autoResizer.unobserve(panel.element);
}
});
}

Expand Down

0 comments on commit 16b1c05

Please sign in to comment.