From e3564e690de366c224cba5032ff4dfe54e2ba613 Mon Sep 17 00:00:00 2001 From: SirusDoma Date: Sun, 19 Apr 2020 13:48:20 +0700 Subject: [PATCH] Fix error when parsing empty line --- Sources/Ksh/Ksh.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Sources/Ksh/Ksh.cs b/Sources/Ksh/Ksh.cs index eb6a8ea..60ff3f6 100644 --- a/Sources/Ksh/Ksh.cs +++ b/Sources/Ksh/Ksh.cs @@ -75,7 +75,7 @@ namespace VoxCharger for (int i = 0; i < lines.Length; i++) { string line = lines[i].Trim(); - if (line.StartsWith("//")) + if (string.IsNullOrEmpty(line) || line.StartsWith("//")) continue; @@ -493,11 +493,14 @@ namespace VoxCharger time = Time.FromOffset(position, signature); for (int j = i + 1; j < lines.Length; j++) { - string ln = lines[j]; - if (char.IsDigit(ln[0])) - noteCount++; - else if (ln == "--") - break; + string ln = lines[j].Trim(); + if (!string.IsNullOrEmpty(ln)) + { + if (char.IsDigit(ln[0])) + noteCount++; + else if (ln == "--") + break; + } } } else if (char.IsDigit(line[0]))