Skip to content

Commit 0c7e8f7

Browse files
committed
fix: add check for empty objects in recursiveParse function
1 parent 24d6ca9 commit 0c7e8f7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/subgraph/src/dataProtector.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ function recursiveParse(
111111

112112
if (entry.value.kind == JSONValueKind.OBJECT) {
113113
const object = entry.value.toObject();
114-
for (let i = 0; i < object.entries.length; i++) {
114+
// Check that the object is not empty before recursion
115+
if (object.entries.length > 0) {
115116
accumulator = accumulator.concat(recursiveParse(object, path));
116117
}
117118
} else if (entry.value.kind == JSONValueKind.STRING) {

0 commit comments

Comments
 (0)