From 05a75d9a0fdd18f7df1281dd92282571d68af623 Mon Sep 17 00:00:00 2001 From: Chewing Glass Date: Tue, 7 Nov 2023 08:49:24 -0600 Subject: [PATCH] Edge cases --- packages/metadata-service/src/model.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/metadata-service/src/model.ts b/packages/metadata-service/src/model.ts index 0fa2c7dde..c27acda20 100644 --- a/packages/metadata-service/src/model.ts +++ b/packages/metadata-service/src/model.ts @@ -59,10 +59,16 @@ class WithRes8LatLgn extends Model { _long: number | undefined = undefined; setLatLng() { - const res8 = cellToParent(new BN(this.location).toString("hex"), 8); - const [latRes8, longRes8] = cellToLatLng(res8); - this._lat = latRes8; - this._long = longRes8; + if (this.location) { + try { + const res8 = cellToParent(new BN(this.location).toString("hex"), 8); + const [latRes8, longRes8] = cellToLatLng(res8); + this._lat = latRes8; + this._long = longRes8; + } catch (e: any) { + console.error("Invalid location", e); + } + } } get lat(): number | undefined {