Recover from null moneyTracker

There shouldn't be any way to get null, but it was reported to occur and this will recover when this happens.
This commit is contained in:
omuretsu 2022-10-25 14:37:25 -04:00
parent 959307aa13
commit d0820c81ce

@ -31,7 +31,7 @@ export class MoneySourceTracker {
// Record money earned // Record money earned
record(amt: number, source: string): void { record(amt: number, source: string): void {
const sanitizedSource = source.toLowerCase(); const sanitizedSource = source.toLowerCase();
if (typeof this[sanitizedSource] !== "number") { if (typeof this[sanitizedSource] !== "number" && this[sanitizedSource] !== null) {
console.warn(`MoneySourceTracker.record() called with invalid source: ${source}`); console.warn(`MoneySourceTracker.record() called with invalid source: ${source}`);
return; return;
} }