fix(core): stringify shouldn't throw when toString returns null/undefined (#14975)
Fixes #14948 PR Close #14975
This commit is contained in:

committed by
Miško Hevery

parent
0759911431
commit
8e6995c91e
@ -69,6 +69,11 @@ export function stringify(token: any): string {
|
||||
}
|
||||
|
||||
const res = token.toString();
|
||||
|
||||
if (res == null) {
|
||||
return '' + res;
|
||||
}
|
||||
|
||||
const newLineIndex = res.indexOf('\n');
|
||||
return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
|
||||
}
|
||||
|
Reference in New Issue
Block a user