Skip to content

Commit 8c7be34

Browse files
author
Niilo Keinänen
committed
Merge remote-tracking branch 'origin/master' into lcjs-4.0
2 parents d2f7a1c + f8f4218 commit 8c7be34

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ dom.window.HTMLCanvasElement.prototype.getContext = function () {
3333
if (arguments[0] === 'webgl') {
3434
// create headless-gl GL context
3535
const ctx: ReturnType<typeof createContext> & Partial<StackGlResize> = createContext(1, 1, arguments[1])
36+
if (!ctx) {
37+
return ctx
38+
}
3639
// insert the resize method to the context so that lcjs package can use it
3740
ctx.resize = ctx.getExtension('STACKGL_resize_drawingbuffer').resize
3841
return ctx

0 commit comments

Comments
 (0)