diff --git a/src/SIL.Machine/Scripture/ScriptureRangeParser.cs b/src/SIL.Machine/Scripture/ScriptureRangeParser.cs index e3f78ba3..bad5211e 100644 --- a/src/SIL.Machine/Scripture/ScriptureRangeParser.cs +++ b/src/SIL.Machine/Scripture/ScriptureRangeParser.cs @@ -39,7 +39,7 @@ private Dictionary> ParseSection(string section) Dictionary> chaptersPerBook = new Dictionary>(); //*Specific chapters from one book* - if (char.IsDigit(section.Last())) + if (char.IsDigit(section.Last()) && section.Length > 3) { string bookName = section.Substring(0, 3); if (!_bookLengths.ContainsKey(bookName)) diff --git a/tests/SIL.Machine.Tests/Scripture/ScriptureRangeParserTests.cs b/tests/SIL.Machine.Tests/Scripture/ScriptureRangeParserTests.cs index 4330f89e..66e57b56 100644 --- a/tests/SIL.Machine.Tests/Scripture/ScriptureRangeParserTests.cs +++ b/tests/SIL.Machine.Tests/Scripture/ScriptureRangeParserTests.cs @@ -27,6 +27,7 @@ public void TestParse(string rangeString, Dictionary> expected public static IEnumerable GetCases() { yield return new TestCaseData("MAL", new Dictionary> { { "MAL", new List() } }, false); + yield return new TestCaseData("PS2", new Dictionary> { { "PS2", new List() } }, false); yield return new TestCaseData( "GEN,EXO", new Dictionary> { { "GEN", new List() }, { "EXO", new List() } },