From e42f5e32d7968f26008d61248b74bb6c16d74647 Mon Sep 17 00:00:00 2001 From: CI Date: Wed, 30 Oct 2024 20:30:03 +0100 Subject: [PATCH] fix: only perform layout resizing if the Layout object exists --- src/hooks/useRive.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/useRive.tsx b/src/hooks/useRive.tsx index 7ab3694..b2dfd5f 100644 --- a/src/hooks/useRive.tsx +++ b/src/hooks/useRive.tsx @@ -83,7 +83,7 @@ export default function useRive( */ const onCanvasHasResized = useCallback(() => { if (rive) { - if (rive.layout.fit === Fit.Layout) { + if (rive.layout && rive.layout.fit === Fit.Layout) { if (canvasElem) { // TODO (Gordon): expose these are properties on JS runtime (rive as any)._devicePixelRatioUsed = devicePixelRatio;