emscripten-core / emscripten-core/emscripten

Uncaught TypeError in setCanvasElementSizeCallingThread

Open
#20,246 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

The error says

`Uncaught TypeError: Cannot read properties of null (reading '0')`

The error comes from the code below.

```js
var autoResizeViewport = false;
if (canvas.GLctxObject && canvas.GLctxObject.GLctx) {
var prevViewport = canvas.GLctxObject.GLctx.getParameter(2978);
autoResizeViewport =
prevViewport[0] === 0 &&
prevViewport[1] === 0 &&
prevViewport[2] === canvas.width &&
prevViewport[3] === canvas.height;
}
```

It seems prevViewport is 0.

I'm not really familiar with the js side. Is the js file that contains `setCanvasElementSizeCallingThread` generated by emsdk? I'm not sure if this is an emsdk issue or a user issue.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.