Fix MLEnhanced Error

This commit is contained in:
thororen1234 2024-10-30 20:05:08 -04:00
parent 01f49f9a53
commit df4d56aacf

View file

@ -25,7 +25,10 @@ export class LimitedMap<K, V> {
set(key: K, value: V) {
if (settings.store.cacheLimit > 0 && this.map.size >= settings.store.cacheLimit) {
// delete the first entry
this.map.delete(this.map.keys().next().value);
const firstKey = this.map.keys().next().value;
if (firstKey !== undefined) {
this.map.delete(firstKey);
}
}
this.map.set(key, value);
}