diff --git a/CHANGELOG.md b/CHANGELOG.md index eb8459f9..9dd176b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ Many thanks to the following for contributing to this release: - Suppresed bogus warning about event listener leak in the browser's console [#600](https://github.com/clusterio/clusterio/pull/600). - Fixed installer breaking on Windows after Node.js released a security fix [#614](https://github.com/clusterio/clusterio/pull/614). - During a data export the mod settings in mod packs will now be corrected to the type of the settings prototype if the type is incorrect. +- Fixed missing color setting causing the Mod Pack view in the Web UI to show an error [#609](https://github.com/clusterio/clusterio/issues/609). Many thanks to the following for contributing to this release: [@Cooldude2606](https://github.com/Cooldude2606) diff --git a/package.json b/package.json index a5f4a506..e62b1c7f 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "scripts": { "build": "tsc --build", "watch": "tsc --build --watch", - "test": "pnpm run build && mocha --check-leaks -R spec --recursive test \"plugins/*/test/**\"", + "test": "pnpm run build && mocha --check-leaks -R spec --recursive test \"plugins/*/test/**\" --exclude \"test/manual/**\"", "fast-test": "FAST_TEST=y pnpm test", "cover": "nyc pnpm test", "fast-cover": "FAST_TEST=y nyc pnpm test", diff --git a/packages/web_ui/src/components/ModPackViewPage.tsx b/packages/web_ui/src/components/ModPackViewPage.tsx index 840155f2..93f07889 100644 --- a/packages/web_ui/src/components/ModPackViewPage.tsx +++ b/packages/web_ui/src/components/ModPackViewPage.tsx @@ -424,7 +424,15 @@ function InputColor(props: { value: lib.ModSettingColor, onChange: (value: lib.ModSettingColor) => void, }) { - const value = props.value; + // In certain edge cases it's possible a value for this mod setting does not exist + // or is of the wrong type. Fallback to black if this is the case. + function isColor(input: unknown) { + if (typeof input !== "object" || input === null) { + return false; + } + return "r" in input && "g" in input && "b" in input && "a" in input; + } + const value = isColor(props.value) ? props.value : { r: 0, g: 0, b: 0, a: 1 }; return