diff --git a/src/geo/polygon.js b/src/geo/polygon.js index 1ffd0c00..e48a63f2 100644 --- a/src/geo/polygon.js +++ b/src/geo/polygon.js @@ -965,7 +965,7 @@ class Polygon { * @returns {number} z value of first point */ getZ(i) { - return this.z !== undefined ? this.z : this.points[i || 0].z; + return this.z !== undefined ? this.z : this.points[i || 0]?.z || 0; } /**