Skip to content

Commit

Permalink
Correctly check object for events
Browse files Browse the repository at this point in the history
stumbled ober an destruction error for "undefined" payload
  • Loading branch information
Apollon77 committed Dec 28, 2024
1 parent 125c9ba commit 96b6691
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/protocol/src/events/OccurrenceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}),
);
Expand Down

0 comments on commit 96b6691

Please sign in to comment.