Safer estimation of possibly undefined values

This commit is contained in:
Cohee
2024-11-29 01:28:10 +02:00
parent 52606616c4
commit c873362d01

View File

@ -696,7 +696,7 @@ export class LimitedMap {
* @returns {number}
*/
static estimateStringSize(str) {
return str.length * 2;
return str ? str.length * 2 : 0;
}
/**