diff --git a/src/actions/auth-precheck.test.ts b/src/actions/auth-precheck.test.ts index da37a925..a8f20010 100644 --- a/src/actions/auth-precheck.test.ts +++ b/src/actions/auth-precheck.test.ts @@ -2,7 +2,6 @@ import { beforeEach, describe, expect, it, vi } from "vitest"; import { clientIp, rateLimit } from "@/lib/rate-limit"; import { captchaConfig, verifyCaptcha } from "@/lib/services/captcha"; -import { siteSettings } from "@/lib/services/site-settings"; import { precheckLogin } from "./auth-precheck"; const core = vi.hoisted(() => ({ diff --git a/src/lib/services/furni-data-i18n.ts b/src/lib/services/furni-data-i18n.ts index 132d886a..aad6f5b7 100644 --- a/src/lib/services/furni-data-i18n.ts +++ b/src/lib/services/furni-data-i18n.ts @@ -457,13 +457,17 @@ export async function buildLocalizedFurniDataFiles( translatedWall = res.translatedWall; total = res.total; } else { - const r = localPrepared.get(preparedKey!)!; + const r = localPrepared.get(preparedKey ?? ""); + if (!r) + throw new Error( + `Missing localPrepared entry for key ${String(preparedKey)}`, + ); const res = finalizeLangFile(r.cloned, r.pendingRefs, translations); json = res.json; translatedRoom = res.translatedRoom; translatedWall = res.translatedWall; total = res.total; - localPrepared.delete(preparedKey!); + if (preparedKey != null) localPrepared.delete(preparedKey); } const targets = await getLocalizedWritePaths(lang); @@ -593,13 +597,17 @@ export async function patchLocalizedFurniDataEntries( added = res.added; total = res.total; } else { - const r = localPrepared.get(localKey!)!; + const r = localPrepared.get(localKey ?? ""); + if (!r) + throw new Error( + `Missing localPrepared entry for key ${String(localKey)}`, + ); const res = finalizePatch(r, translations); json = res.json; patched = res.patched; added = res.added; total = res.total; - localPrepared.delete(localKey!); + if (localKey != null) localPrepared.delete(localKey); } for (const target of targets) { diff --git a/src/lib/services/swf/conversion-pool.ts b/src/lib/services/swf/conversion-pool.ts index 64e3a031..41476dfc 100644 --- a/src/lib/services/swf/conversion-pool.ts +++ b/src/lib/services/swf/conversion-pool.ts @@ -79,8 +79,9 @@ function ensurePool(): boolean { function pump() { while (idle.length > 0 && queue.length > 0) { - const w = idle.pop()!; - const job = queue.shift()!; + const w = idle.pop(); + const job = queue.shift(); + if (!w || !job) break; pending.set(job.req.id, { worker: w, job }); w.postMessage(job.req); }