diff options
Diffstat (limited to 'src/data')
-rw-r--r-- | src/data/validators.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/data/validators.js b/src/data/validators.js index b27dd68f..d89c23bb 100644 --- a/src/data/validators.js +++ b/src/data/validators.js @@ -311,8 +311,11 @@ export function isCommentary(commentaryText) { const ownInput = commentaryText.slice(position, position + length); const restOfInput = commentaryText.slice(position + length); - const nextLineBreak = restOfInput.indexOf('\n'); - const upToNextLineBreak = restOfInput.slice(0, nextLineBreak); + + const upToNextLineBreak = + (restOfInput.includes('\n') + ? restOfInput.slice(0, restOfInput.indexOf('\n')) + : restOfInput); if (/\S/.test(upToNextLineBreak)) { throw new TypeError( |