Skip to content

Commit 64062ee

Browse files
committed
Fix showing default validation message only when necessary
1 parent c6a1064 commit 64062ee

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

scripts.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ function processFile(file_contents) {
175175
row_node.appendChild(lyrics_node);
176176
}
177177

178-
if (errors) {
178+
if (errors.length > 0) {
179179
alert(errors.join('\n'));
180180
}
181181

@@ -338,12 +338,12 @@ function processMetadata(row) {
338338
}
339339

340340
function validateMaxCharsPerLine(errors, line, index) {
341-
if (errors.length === 0) {
342-
errors.push("Lines shouldn't have more than " + MAX_CHARS_PER_LINE +
343-
" characters for better visualization in mobile devices:\n")
344-
}
345-
346341
if (reachedMaxCharsPerLine(line)) {
342+
if (errors.length === 0) {
343+
errors.push("Lines shouldn't have more than " + MAX_CHARS_PER_LINE +
344+
" characters for better visualization in mobile devices:\n")
345+
}
346+
347347
errors.push(getReachedMaxCharsPerLineMessage(index, line));
348348
}
349349
}

0 commit comments

Comments
 (0)