Skip to content

Commit

Permalink
Check for empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
Enkidu93 committed Jul 12, 2024
1 parent 04276d7 commit e32df20
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/SIL.Machine/Scripture/ScriptureRangeParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ public Dictionary<string, List<int>> GetChapters(string chapterSelections)
Dictionary<string, List<int>> chaptersPerBook = new Dictionary<string, List<int>>();
chapterSelections = chapterSelections.Trim();

if (chapterSelections.Length == 0)
{
return chaptersPerBook;
}

char delimiter = ';';
if (chapterSelections.Contains(';'))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ public static IEnumerable<TestCaseData> GetCases()
new Dictionary<string, List<int>> { { "JHN", new List<int>() } },
false
);
yield return new TestCaseData("", new Dictionary<string, List<int>>(), false);

//*Throw exceptions
yield return new TestCaseData("MAT3-1", new Dictionary<string, List<int>>(), true);
Expand All @@ -185,7 +186,6 @@ public static IEnumerable<TestCaseData> GetCases()
yield return new TestCaseData("MAT0-10", new Dictionary<string, List<int>>(), true);
yield return new TestCaseData("MAT-FLUM", new Dictionary<string, List<int>>(), true);
yield return new TestCaseData("-MAT-FLUM", new Dictionary<string, List<int>>(), true);
yield return new TestCaseData("", new Dictionary<string, List<int>>(), true);
yield return new TestCaseData("ABC", new Dictionary<string, List<int>>(), true);
yield return new TestCaseData("MAT-ABC", new Dictionary<string, List<int>>(), true);
yield return new TestCaseData("NT;-ABC-LUK", new Dictionary<string, List<int>>(), true);
Expand Down

0 comments on commit e32df20

Please sign in to comment.