Skip to content

Commit d530521

Browse files
lesbaaLes Moffat
and
Les Moffat
authored
RD858 projection is sometimes undefined (#176)
* fix(Map.isGlobeProjection): test projection object before accessing `type` as it may be undefined * 3.0.3 * chore(Map): fix typo * chore(changelog): update changelog for release --------- Co-authored-by: Les Moffat <les.moffat@maptiler.com>
1 parent 22f15b8 commit d530521

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# MapTiler SDK Changelog
22

3+
## 3.0.3
4+
## ✨ Features and improvements
5+
None
6+
7+
## 🐛 Bug fixes
8+
Fixes a bug that accesses undefined `projection` object in `Map.getProjection` method
9+
10+
## 🔧 Others
11+
None
12+
313
## 3.0.2
414
## ✨ Features and improvements
515
None

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@maptiler/sdk",
3-
"version": "3.0.2",
3+
"version": "3.0.3",
44
"description": "The Javascript & TypeScript map SDK tailored for MapTiler Cloud",
55
"author": "MapTiler",
66
"module": "dist/maptiler-sdk.mjs",

src/Map.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,6 +1517,11 @@ export class Map extends maplibregl.Map {
15171517
*/
15181518
isGlobeProjection(): boolean {
15191519
const projection = this.getProjection();
1520+
// this type is incorrect, `projection` can be undefined
1521+
1522+
if (!projection) {
1523+
return false;
1524+
}
15201525

15211526
return projection.type === "globe";
15221527
}

0 commit comments

Comments
 (0)