Skip to content

Commit

Permalink
Fixed a bug causing map.indexOf to bail out after encountering a null…
Browse files Browse the repository at this point in the history
… value.
  • Loading branch information
JoeStrout committed Sep 13, 2023
1 parent 5e4f43f commit 3fdaced
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions MiniScript-cs/MiniscriptIntrinsics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -606,11 +606,11 @@ public static void InitIfNeeded() {
} else if (self is ValMap) {
ValMap map = (ValMap)self;
bool sawAfter = (after == null);
foreach (Value k in map.map.Keys) {
foreach (var kv in map.map) {
if (!sawAfter) {
if (k.Equality(after) == 1) sawAfter = true;
if (kv.Key.Equality(after) == 1) sawAfter = true;
} else {
if (map.map[k].Equality(value) == 1) return new Intrinsic.Result(k);
if (kv.Value == null ? value == null : kv.Value.Equality(value) == 1) return new Intrinsic.Result(kv.Key);
}
}
}
Expand Down

0 comments on commit 3fdaced

Please sign in to comment.