Skip to content

Commit

Permalink
Merge branch 'nk/minor-tweak' into 'master'
Browse files Browse the repository at this point in the history
Return null when gl context not available instead of crashing

See merge request arction/lcjs/lcjs-headless!2
  • Loading branch information
Snekw committed Jan 10, 2023
2 parents 2d01298 + d3fa95f commit f8f4218
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ dom.window.HTMLCanvasElement.prototype.getContext = function () {
if (arguments[0] === 'webgl') {
// create headless-gl GL context
const ctx: ReturnType<typeof createContext> & Partial<StackGlResize> = createContext(1, 1, arguments[1])
if (!ctx) {
return ctx
}
// insert the resize method to the context so that lcjs package can use it
ctx.resize = ctx.getExtension('STACKGL_resize_drawingbuffer').resize
return ctx
Expand Down

0 comments on commit f8f4218

Please sign in to comment.