Skip to content

Commit 33aa00f

Browse files
committed
fix: only get state if it's available
1 parent 23e7efe commit 33aa00f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: libs/core/src/lib/events.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ export function createEvents(store: NgtSignalStore<NgtState>) {
191191
.flatMap(handleRaycast)
192192
// Sort by event priority and distance
193193
.sort((a, b) => {
194-
const aState = getLocalState(a.object).store.get();
195-
const bState = getLocalState(b.object).store.get();
194+
const aState = getLocalState(a.object).store?.get();
195+
const bState = getLocalState(b.object).store?.get();
196196
if (!aState || !bState) return a.distance - b.distance;
197197
return bState.events.priority - aState.events.priority || a.distance - b.distance;
198198
})

0 commit comments

Comments
 (0)