diff --git a/index.html b/index.html
index 9d8c9538..52ab5795 100644
--- a/index.html
+++ b/index.html
@@ -8149,7 +8149,7 @@
-
+
diff --git a/modules/io/load.js b/modules/io/load.js
index 8e05a798..13d2ec9e 100644
--- a/modules/io/load.js
+++ b/modules/io/load.js
@@ -489,12 +489,16 @@ async function parseLoadedData(data, mapVersion) {
if (textureHref) updateTextureSelectValue(textureHref);
}
+ // data integrity checks
{
- const cells = pack.cells;
+ const {cells, vertices} = pack;
- if (pack.cells.i.length !== pack.cells.state.length) {
- const message = "[Data integrity] Striping issue detected. To fix edit the heightmap in ERASE mode";
- ERROR && console.error(message);
+ const cellsMismatch = cells.i.length !== cells.state.length;
+ const featureVerticesMismatch = pack.features.some(f => f?.vertices?.some(vertex => !vertices.p[vertex]));
+
+ if (cellsMismatch || featureVerticesMismatch) {
+ const message = "[Data integrity] Striping issue detected. To fix try to edit the heightmap in ERASE mode";
+ throw new Error(message);
}
const invalidStates = [...new Set(cells.state)].filter(s => !pack.states[s] || pack.states[s].removed);
@@ -745,7 +749,7 @@ async function parseLoadedData(data, mapVersion) {
$("#alert").dialog({
resizable: false,
title: "Loading error",
- maxWidth: "50em",
+ maxWidth: "40em",
buttons: {
"Clear cache": () => cleanupData(),
"Select file": function () {
diff --git a/modules/renderers/draw-features.js b/modules/renderers/draw-features.js
index ac2a395e..74e16c87 100644
--- a/modules/renderers/draw-features.js
+++ b/modules/renderers/draw-features.js
@@ -51,6 +51,11 @@ function drawFeatures() {
function getFeaturePath(feature) {
const points = feature.vertices.map(vertex => pack.vertices.p[vertex]);
+ if (points.some(point => point === undefined)) {
+ ERROR && console.error("Undefined point in getFeaturePath");
+ return "";
+ }
+
const simplifiedPoints = simplify(points, 0.3);
const clippedPoints = clipPoly(simplifiedPoints, 1);
diff --git a/utils/commonUtils.js b/utils/commonUtils.js
index dd4c3d45..2be3e36d 100644
--- a/utils/commonUtils.js
+++ b/utils/commonUtils.js
@@ -4,6 +4,11 @@
// clip polygon by graph bbox
function clipPoly(points, secure = 0) {
if (points.length < 2) return points;
+ if (points.some(point => point === undefined)) {
+ ERROR && console.error("Undefined point in clipPoly", points);
+ return points;
+ }
+
return polygonclip(points, [0, 0, graphWidth, graphHeight], secure);
}
diff --git a/versioning.js b/versioning.js
index e12cea06..461ab1c7 100644
--- a/versioning.js
+++ b/versioning.js
@@ -13,7 +13,7 @@
* Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2
*/
-const VERSION = "1.106.7";
+const VERSION = "1.107.1";
if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function");
{