Skip to content

Commit 2970404

Browse files
prjanitorsplincode
andauthored
fix(ngxs): missing null check before accessing meta.version property (#1539)
Co-authored-by: Максим Иванов <omaxphp@yandex.ru>
1 parent ffd0381 commit 2970404

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

libs/ngxs/storage/utils/deserialize-by-storage-meta.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ export function deserializeByStorageMeta<T>(
3434
throw new InvalidStructureDataException(`"${value}" not an object`);
3535
}
3636

37-
function versionIsInvalid<T>(meta: StorageMeta<T>): boolean {
37+
function versionIsInvalid<T>(meta?: StorageMeta<T> | null): boolean {
38+
if (!meta) {
39+
return true;
40+
}
41+
3842
const version: number = parseFloat(meta.version?.toString() ?? '');
3943

4044
return (

0 commit comments

Comments
 (0)