1
0
mirror of https://github.com/SirusDoma/VoxCharger.git synced 2025-02-25 22:08:35 +01:00

Fix error when parsing empty line

This commit is contained in:
SirusDoma 2020-04-19 13:48:20 +07:00
parent f07753e1bb
commit e3564e690d

View File

@ -75,7 +75,7 @@ namespace VoxCharger
for (int i = 0; i < lines.Length; i++) for (int i = 0; i < lines.Length; i++)
{ {
string line = lines[i].Trim(); string line = lines[i].Trim();
if (line.StartsWith("//")) if (string.IsNullOrEmpty(line) || line.StartsWith("//"))
continue; continue;
@ -493,13 +493,16 @@ namespace VoxCharger
time = Time.FromOffset(position, signature); time = Time.FromOffset(position, signature);
for (int j = i + 1; j < lines.Length; j++) for (int j = i + 1; j < lines.Length; j++)
{ {
string ln = lines[j]; string ln = lines[j].Trim();
if (!string.IsNullOrEmpty(ln))
{
if (char.IsDigit(ln[0])) if (char.IsDigit(ln[0]))
noteCount++; noteCount++;
else if (ln == "--") else if (ln == "--")
break; break;
} }
} }
}
else if (char.IsDigit(line[0])) else if (char.IsDigit(line[0]))
{ {
// Increment offset when current line is event // Increment offset when current line is event