From 386fd2f38758b32afd5fdc13efa7a60263fc2100 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Wed, 13 May 2026 03:41:00 +0200 Subject: [PATCH] Add optional integer reading utility and update version compatibility for spline repeaters. --- src/document/migrate-scene-document.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/document/migrate-scene-document.ts b/src/document/migrate-scene-document.ts index 22108db5..ba8c6a01 100644 --- a/src/document/migrate-scene-document.ts +++ b/src/document/migrate-scene-document.ts @@ -767,6 +767,24 @@ function readOptionalPositiveInteger( return integerValue; } +function readOptionalInteger( + value: unknown, + label: string, + fallback: number +): number { + if (value === undefined) { + return fallback; + } + + const integerValue = expectFiniteNumber(value, label); + + if (!Number.isInteger(integerValue)) { + throw new Error(`${label} must be an integer.`); + } + + return integerValue; +} + function readOptionalPositiveIntegerWithMax( value: unknown, label: string, @@ -6562,6 +6580,7 @@ export function migrateSceneDocument(source: unknown): SceneDocument { source.version !== PATH_ROAD_PREVIEW_SCENE_DOCUMENT_VERSION && source.version !== DYNAMIC_TERRAIN_LAYERS_SCENE_DOCUMENT_VERSION && source.version !== SPLINE_ROAD_EDGES_SCENE_DOCUMENT_VERSION && + source.version !== SPLINE_REPEATERS_SCENE_DOCUMENT_VERSION && source.version !== NPC_TARGETING_SCENE_DOCUMENT_VERSION ) { throw new Error(