mirror of
https://github.com/Darkrock-Studios/hammer-editor.git
synced 2026-08-04 15:19:46 +00:00
SerializationException, dropping the IllegalArgumentException branch that readJsonOrNull already has. tomlkt doesn't route every decode failure through SerializationException: a stale stats.toml (old schema, e.g. a non-integer key in Map<Int, Int>) throws a raw NumberFormatException. That uncaught exception killed the parallelMap worker for the affected project, nulled its result slot, and filterNotNull() dropped it from the project selection list — while sync, a different path, still showed it. Add a readTomlOrNull helper mirroring readJsonOrNull that absorbs the full set tomlkt can throw on bad input (SerializationException, IllegalArgumentException incl. NumberFormatException, IllegalStateException from parser errors, IOException), with an onError callback so callers keep their site-specific logging. Schema-version checks run after decode, so they can't rescue a decode that throws first. Migrate every TOML read site to it: ProjectStatisticsCacheReader, StatisticsDatasource, ProjectDataDatasource, ProjectsListComponent, ReferenceIndexDatasource, WritingActivityDatasource, and SceneMetadataDatasource (which previously had no error handling at all). Stale caches are now treated as a miss and recalculated. Add ReadTomlOrNullTest covering each exception family and a ProjectStatisticsCacheReaderTest reproducing the original crash. |
||
|---|---|---|
| .. | ||
| src | ||
| build.gradle.kts | ||