diff --git a/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/DelayedFullDataSourceSaveCache.java b/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/DelayedFullDataSourceSaveCache.java index 12f434f25..885786b9a 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/DelayedFullDataSourceSaveCache.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/DelayedFullDataSourceSaveCache.java @@ -96,7 +96,12 @@ public class DelayedFullDataSourceSaveCache implements AutoCloseable // no data currently in the memory cache for this position memoryDataSource = FullDataSourceV2.createEmpty(inputPos); pair = new DataSourceSavedTimePair(memoryDataSource); - this.dataSourceByPosition.put(inputPos, pair); + DataSourceSavedTimePair oldPair = this.dataSourceByPosition.put(inputPos, pair); + if (oldPair != null) + { + // shouldn't happen, but just in case + this.handleDataSourceRemoval(oldPair.dataSource); + } } else {