avoid NPE

This commit is contained in:
Simon Knott 2024-09-04 09:28:18 +02:00
parent bb79be9225
commit f8d9dd3452
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -41,7 +41,7 @@ function cacheAndReturn(key: SnapshotRenderer, compute: () => string): string {
const result = compute(); const result = compute();
while (cacheSize + result.length > CACHE_SIZE) { while (cache.size && cacheSize + result.length > CACHE_SIZE) {
const first = cache.keys().next().value; const first = cache.keys().next().value;
cacheSize -= cache.get(first)!.length; cacheSize -= cache.get(first)!.length;
cache.delete(first); cache.delete(first);