[L2] Dead null-check in getDefaultGPUDevice #28

Open
opened 2026-06-27 03:54:48 +00:00 by sessamekesh · 0 comments
Owner

File: packages/viewer-react/src/IgviewerContext.tsx:37-40

const device = await adapter.requestDevice();
if (!device) {
  throw new Error("Failed to initialize WebGPU device");
}

GPUAdapter.requestDevice() rejects on failure rather than resolving null, so the if (!device) branch is unreachable. Minor cleanup.


Filed by an automated AI code review (manual proof-of-concept run). Code locations reference the various-cleanup branch.

**File:** `packages/viewer-react/src/IgviewerContext.tsx:37-40` ```ts const device = await adapter.requestDevice(); if (!device) { throw new Error("Failed to initialize WebGPU device"); } ``` `GPUAdapter.requestDevice()` rejects on failure rather than resolving `null`, so the `if (!device)` branch is unreachable. Minor cleanup. --- _Filed by an automated AI code review (manual proof-of-concept run). Code locations reference the `various-cleanup` branch._
Sign in to join this conversation.
No description provided.