Skip to content

Commit

Permalink
Merge pull request #21 from smartlyio/fix-crashing-bug
Browse files Browse the repository at this point in the history
Fix crashing bug on reading keys of null
  • Loading branch information
Chamion authored Oct 7, 2024
2 parents ee3d978 + 1865638 commit e0bb430
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/yavl/src/validate/notifySubscribers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ const getNextValueForAnnotationsSubscription = (
): AnnotationsSubscriptionValue => {
if (value === noValue) {
const nextValue = { ...subscription.previousValue };
const keys = Object.keys(nextValue[path]);
const keys = nextValue[path] == null ? null : Object.keys(nextValue[path]);

if ((keys.length === 1 && keys[0] === annotation) || keys.length === 0) {
if ((keys == null || keys.length === 1 && keys[0] === annotation) || keys.length === 0) {
delete nextValue[path];
return nextValue;
}
Expand Down

0 comments on commit e0bb430

Please sign in to comment.