fix: add console warnings for invalid games.json entries
This commit is contained in:
@@ -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';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user