Skip to content

Conversation

@jameshfisher
Copy link
Contributor

@jameshfisher jameshfisher commented Sep 24, 2020

getWebGLRenderingContext can clearly return null.
This is expected behavior, because canvas.getContext can return null.
We therefore must check for null before trying to call .isContextLost on it.

To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.


This change is Reviewable

getWebGLRenderingContext can clearly return null.
This is expected behavior, because canvas.getContext can return null.
We therefore must check for null before trying to call .isContextLost on it.
@jameshfisher
Copy link
Contributor Author

For further context, see #3969

@tafsiri tafsiri requested a review from annxingyuan September 29, 2020 03:41
if (!(webGLVersion in contexts)) {
contexts[webGLVersion] = getWebGLRenderingContext(webGLVersion);
const newCtx = getWebGLRenderingContext(webGLVersion);
if (newCtx) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newCtx != null

Copy link
Contributor

@annxingyuan annxingyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jameshfisher ! Just left a small comment.

@annxingyuan annxingyuan merged commit f583edb into tensorflow:master Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants