check for the empty string
Summary:
Bug:
{F157985015}
Reviewed By: danielbuechele
Differential Revision: D15260689
fbshipit-source-id: c43cdc0fc0d3e624ad930af60a9c95996579acb6
This commit is contained in:
committed by
Facebook Github Bot
parent
4dcb41f5e6
commit
8684812907
@@ -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++;
|
||||||
|
|||||||
Reference in New Issue
Block a user