]> zoso.dev Git - nano-pow.git/commitdiff
Only set GPU lost promise callback if lost actually exists as a property on the device.
authorChris Duncan <chris@zoso.dev>
Sat, 8 Mar 2025 09:05:50 +0000 (01:05 -0800)
committerChris Duncan <chris@zoso.dev>
Sat, 8 Mar 2025 09:05:50 +0000 (01:05 -0800)
src/classes/gpu.ts

index b00e72723bf13f8d6616cfd9e3ea50d53fa9e83f..c11476c2085d4b27f6781e615efca823822859d3 100644 (file)
@@ -33,7 +33,7 @@ export class NanoPowGpu {
                        if (adapter == null) throw new Error('WebGPU adapter refused by browser.')
                        const device = await adapter.requestDevice()
                        if (!(device instanceof GPUDevice)) throw new Error('WebGPU device failed to load.')
-                       device.lost.then(this.reset)
+                       device.lost?.then(this.reset)
                        this.#device = device
                        this.setup()
                } catch (err) {