avoid NPE
This commit is contained in:
parent
bb79be9225
commit
f8d9dd3452
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue