Skip to content

Commit

Permalink
Fix error when loading scenes without THT data.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wibble199 committed Dec 12, 2024
1 parent d8f7238 commit ecaf39f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "terrain-height-tools",
"title": "Terrain Height Tools",
"description": "Tools for painting grid cells with terrain heights and calculating line of sight with respect to these heights.",
"version": "0.4.5",
"version": "0.4.6",
"compatibility": {
"minimum": "11",
"verified": "11",
Expand Down
2 changes: 1 addition & 1 deletion module/utils/height-map-migrations.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const migrations = [
export function migrateData(data, targetVersion = DATA_VERSION) {
// If there is no data, return a blank V1 map
if (!data) {
return { v: 1, data: {} };
return { v: 2, data: [] };
}

// Try to get the `v` value from the data. If there is no `v` value, then treat it as v0. Then, sequentially apply
Expand Down
4 changes: 2 additions & 2 deletions test/utils/height-map-migrations.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,11 @@ describe("migrateData()", () => {

it("should correctly initialise a blank HeightMapDataV1 when given undefined", () => {
const blank = migrateData(undefined);
assert.deepEqual(blank, { v: 1, data: {} });
assert.deepEqual(blank, { v: 2, data: [] });
});

it("should correctly initialise a blank HeightMapDataV1 when given null", () => {
const blank = migrateData(null);
assert.deepEqual(blank, { v: 1, data: {} });
assert.deepEqual(blank, { v: 2, data: [] });
});
});

0 comments on commit ecaf39f

Please sign in to comment.