Skip to content

Commit

Permalink
Edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ChewingGlass committed Nov 7, 2023
1 parent f87a8e4 commit 05a75d9
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/metadata-service/src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 05a75d9

Please sign in to comment.