From 96b669144ae635f72760472dbf3baef0fb152cea Mon Sep 17 00:00:00 2001 From: Ingo Fischer Date: Sat, 28 Dec 2024 10:22:34 +0100 Subject: [PATCH] Correctly check object for events stumbled ober an destruction error for "undefined" payload --- packages/protocol/src/events/OccurrenceManager.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/protocol/src/events/OccurrenceManager.ts b/packages/protocol/src/events/OccurrenceManager.ts index 7f765cdbc..c7f86a3c6 100644 --- a/packages/protocol/src/events/OccurrenceManager.ts +++ b/packages/protocol/src/events/OccurrenceManager.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { asyncNew, Construction, ImplementationError, Logger, MaybePromise } from "#general"; +import { asyncNew, Construction, ImplementationError, isObject, Logger, MaybePromise } from "#general"; import { EventNumber, EventPriority, @@ -158,7 +158,10 @@ export class OccurrenceManager { if (filterForFabricIndex !== undefined) { result = MaybePromise.then(result, (occurrences: NumberedOccurrence[]) => occurrences.filter(({ payload }) => { - const { fabricIndex } = payload as any; + if (!isObject(payload)) { + return true; + } + const { fabricIndex } = payload; return fabricIndex === undefined || fabricIndex === filterForFabricIndex; }), );