Skip to content

Commit

Permalink
Merge pull request inkle#859 from Meorge/fix-list-range
Browse files Browse the repository at this point in the history
Fix checking for upper bound's type in LIST_RANGE
  • Loading branch information
joethephish authored May 22, 2024
2 parents f9e889e + cfb3418 commit bed7620
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ink-engine-runtime/InkList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ public InkList ListWithSubRange(object minBound, object maxBound)
maxValue = (int)maxBound;
else
{
if (minBound is InkList && ((InkList)minBound).Count > 0)
if (maxBound is InkList && ((InkList)maxBound).Count > 0)
maxValue = ((InkList)maxBound).maxItem.Value;
}

Expand Down
2 changes: 2 additions & 0 deletions tests/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3633,6 +3633,7 @@ public void TestListRange()
{all}
{LIST_RANGE(all, 2, 3)}
{LIST_RANGE(LIST_ALL(Numbers), Two, Six)}
{LIST_RANGE(LIST_ALL(Numbers), Currency, Three)}
{LIST_RANGE((Pizza, Pasta), -1, 100)} // allow out of range
";

Expand All @@ -3642,6 +3643,7 @@ public void TestListRange()
@"Pound, Pizza, Euro, Pasta, Dollar, Curry, Paella
Euro, Pasta, Dollar, Curry
Two, Three, Four, Five, Six
One, Two, Three
Pizza, Pasta
".Replace(Environment.NewLine, "\n"), story.ContinueMaximally());
}
Expand Down

0 comments on commit bed7620

Please sign in to comment.