diff --git a/CHANGELOG.md b/CHANGELOG.md index 51ebab2..3b111bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and  ## [Unreleased] +### Fixed + +- The `maxDensity` field in metadata files when `-max-density 1` is specified now gets the correct value instead of the erroneous `null`. + ## [3.0.0] — 2024–12–15 ### Changed diff --git a/lib/processRaster.js b/lib/processRaster.js index 77c542c..22c0f13 100644 --- a/lib/processRaster.js +++ b/lib/processRaster.js @@ -108,7 +108,7 @@ export async function processRaster (options) { let isMetaFileExists = await fileExists(metaJsonPath) let metaData = isMetaFileExists ? await readJsonFile(metaJsonPath) : {} - metaData.maxDensity = Math.max(metaData.maxDensity, originDensity) + metaData.maxDensity = metaData.maxDensity ? Math.max(metaData.maxDensity, originDensity) : originDensity metaData.formats = Array.from(new Set([...metaData.formats || [], ...formats])) metaData.sizes = Array.from(new Set([...metaData.sizes || [], ...sizes].sort((a, b) => { if (!a.breakpoint) return 1