fix: add console warnings for invalid games.json entries

This commit is contained in:
Jannis Braun
2026-03-21 03:00:14 +01:00
parent 0f4f129337
commit 2c122d066e
+10 -5
View File
@@ -70,13 +70,18 @@ function loadDictionary(): boolean {
processMap = new Map(); processMap = new Map();
for (const entry of parsed) { for (const entry of parsed) {
if (!entry || typeof entry !== 'object') continue; if (!entry || typeof entry !== 'object') {
console.warn('[ActivityDetector] Skipping invalid entry (not an object)');
continue;
}
const e = entry as Record<string, unknown>; const e = entry as Record<string, unknown>;
if (typeof e.id !== 'string' || !e.id) continue; if (typeof e.id !== 'string' || !e.id || typeof e.name !== 'string' || !e.name ||
if (typeof e.name !== 'string' || !e.name) continue; !Array.isArray(e.processes) || e.processes.length === 0 ||
if (!Array.isArray(e.processes) || e.processes.length === 0) continue; !e.processes.every((p: unknown) => typeof p === 'string')) {
if (!e.processes.every((p: unknown) => typeof p === 'string')) continue; console.warn('[ActivityDetector] Skipping invalid entry:', e.id ?? JSON.stringify(e));
continue;
}
const type = typeof e.type === 'string' && VALID_TYPES.has(e.type) ? e.type : 'playing'; const type = typeof e.type === 'string' && VALID_TYPES.has(e.type) ? e.type : 'playing';