Skip to content

Commit

Permalink
Fail safe restrictedCollection (plus some debug to help diagnose an i…
Browse files Browse the repository at this point in the history
…ssue).
  • Loading branch information
Senryoku committed May 31, 2023
1 parent d844a16 commit 2b849c2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,10 @@ export class Session implements IIndexable {
const restricted: CardPool = new Map();
if (sets && sets.length > 0) {
for (const s of sets)
for (const cid of CardsBySet[s].filter((cid) => cardPool.has(cid)))
restricted.set(cid, cardPool.get(cid) as number);
if (s in CardsBySet)
for (const cid of CardsBySet[s].filter((cid) => cardPool.has(cid)))
restricted.set(cid, cardPool.get(cid) as number);
else console.error(`Session.restrictedCollection Error: '${s}' not in CardsBySet.`);
return restricted;
} else return cardPool;
}
Expand Down

0 comments on commit 2b849c2

Please sign in to comment.