From cd1fa3b65150b8ce1409238959bc91f6898dd247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillem=20Sard=C3=A0=20Parreu?= Date: Wed, 8 Jan 2025 12:07:11 +0100 Subject: [PATCH 1/2] fix(realm/Results): provide fallback condition --- packages/realm/src/Results.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/realm/src/Results.ts b/packages/realm/src/Results.ts index 10cd921d9d..78ea4a5d23 100644 --- a/packages/realm/src/Results.ts +++ b/packages/realm/src/Results.ts @@ -92,8 +92,8 @@ export class Results extends OrderedCollection< throw new Error("Modifying a Results collection is not supported."); } - get length(): number { - return this.internal.size(); + get length() { + return this.internal ? this.internal.size() : 0; } set length(value: number) { From 381ac3ec649363f1295650893a450901992ab150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillem=20Sard=C3=A0=20Parreu?= <88349941+guillemsarda@users.noreply.github.com> Date: Thu, 9 Jan 2025 16:01:19 +0100 Subject: [PATCH 2/2] Update packages/realm/src/Results.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Albert MaƱosa <26429103+albertms10@users.noreply.github.com> --- packages/realm/src/Results.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/realm/src/Results.ts b/packages/realm/src/Results.ts index 78ea4a5d23..4ed2aea787 100644 --- a/packages/realm/src/Results.ts +++ b/packages/realm/src/Results.ts @@ -93,7 +93,7 @@ export class Results extends OrderedCollection< } get length() { - return this.internal ? this.internal.size() : 0; + return this.internal?.size() ?? 0; } set length(value: number) {