check for the empty string

Summary:
Bug:

{F157985015}

Reviewed By: danielbuechele

Differential Revision: D15260689

fbshipit-source-id: c43cdc0fc0d3e624ad930af60a9c95996579acb6
This commit is contained in:
Pritesh Nandgaonkar
2019-05-09 07:18:56 -07:00
committed by Facebook Github Bot
parent 4dcb41f5e6
commit 8684812907

View File

@@ -58,6 +58,9 @@ const Icon = styled(Glyph)({
function getLineCount(str: string): number { function getLineCount(str: string): number {
let count = 1; let count = 1;
if (!(typeof str === 'string')) {
return 0;
}
for (let i = 0; i < str.length; i++) { for (let i = 0; i < str.length; i++) {
if (str[i] === '\n') { if (str[i] === '\n') {
count++; count++;