Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't crash when using destroyed textures #2515

Merged
merged 1 commit into from
Nov 2, 2020

Conversation

slimbuck
Copy link
Member

Fixes #2513

This PR fixes a crash that happens when a texture which has already been destroyed is still referenced by a material in the scene.

When the scene is next rendered, the texture will have its WebGL interfaces created etc and will ultimately crash at https://github.com/playcanvas/engine/blob/master/src/graphics/device.js#L1799 because _levels is null.

This PR sets texture._levels to the constructor default value instead of null thereby circumventing the crash.

I confirm I have signed the Contributor License Agreement.

@slimbuck slimbuck added the bug label Oct 30, 2020
@slimbuck slimbuck requested a review from a team October 30, 2020 18:40
@slimbuck slimbuck self-assigned this Oct 30, 2020
@slimbuck slimbuck merged commit 620d41d into playcanvas:master Nov 2, 2020
@slimbuck slimbuck deleted the texture-crash-fix branch November 2, 2020 09:37
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.

If texture asset is unloaded before a model that uses it is first rendered, an exception occurs
2 participants