fix: TypeError when running astral on empty string

pull/10/merge
Amio 2018-08-14 21:37:26 +08:00
rodzic 6d70dd372e
commit dd99690c25
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -7,7 +7,7 @@ function calcWidth (charWidthTable) {
widthTable[64] = widthTable[64] + 6 // Slightly increase width of "@" by 0.6px
return function (text, astral) {
if (astral) text = text.match(astralRegex)
if (astral) text = text.match(astralRegex) || []
let total = 0
let code = 0