From c873362d0140208857d1857e637916d00d1c4d9a Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 29 Nov 2024 01:28:10 +0200 Subject: [PATCH] Safer estimation of possibly undefined values --- src/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.js b/src/util.js index d03fb6a9c..8a1334259 100644 --- a/src/util.js +++ b/src/util.js @@ -696,7 +696,7 @@ export class LimitedMap { * @returns {number} */ static estimateStringSize(str) { - return str.length * 2; + return str ? str.length * 2 : 0; } /**