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

Missing textures crash the renderer #106

Closed
SmiVan opened this issue Jan 10, 2021 · 6 comments · Fixed by #107
Closed

Missing textures crash the renderer #106

SmiVan opened this issue Jan 10, 2021 · 6 comments · Fixed by #107

Comments

@SmiVan
Copy link
Contributor

SmiVan commented Jan 10, 2021

Encountered in the 1.0.2 (and earlier) versions of OMORI, as discussed on the Steam bug reports page.

It seems to use a different fork of pixi-tilemap, judging by the slightly different variable names, so it has to be verified if this issue is present in this version.


In the implementation of renderCanvasCore in RectTileLayer.ts there is no check to see if a texture is defined or not, thus leading to crashes with Uncaught TypeError: Cannot read property 'baseTexture' of undefined. if it does not.

https://github.com/pixijs/pixi-tilemap/blob/389c82082def66e0563d2a11a8f78ec9eac424d1/src/RectTileLayer.ts#L160-L166

My proposed fix is modifying the if condition to be textureIndex >= 0 && this.textures[textureIndex] !== undefined, so that undefined textures are skipped, but I'm not sure whether that is computationally efficient.

Instead of crashing, a more useful behaviour would be logging the error for the developer to see.

@ivanpopelyshev
Copy link
Collaborator

textureIndex >=0 && this,textures[textureIndex] should be fine. drawImage costs much more than those ifs.
Care to make a PR?

@SmiVan
Copy link
Contributor Author

SmiVan commented Jan 12, 2021

Is there a standard for error logging in this project, or should I just leave it ignored?

@ivanpopelyshev
Copy link
Collaborator

No standards, just leave it ignored for now.

@ivanpopelyshev
Copy link
Collaborator

textures were supposed to have nulls or undefineds for rpgmaker mv, and i remember that Omori uses it, right?

@SmiVan
Copy link
Contributor Author

SmiVan commented Jan 12, 2021

Omori does use RPG Maker MV, listed here.

@ivanpopelyshev
Copy link
Collaborator

Good!

Those checks exists in webgl: https://github.com/pixijs/pixi-tilemap/blob/master/src/TileRenderer.ts#L52
and missing in canvas2d, so you can make PR for it if you want, it doesnt need console message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants