Jump to content

Cannot read property 'width' of null when moving away from screen


royibernthal
 Share

Recommended Posts

I have an Ionic app that uses the latest versions of angular 4 and ionic 3.

I'm using PIXI (4.5.2) in one of the screens in it - the game screen.

The player frequently moves in and out of that screen.

 

Before starting the game I'm:

-Preparing resources

-Moving to game screen

-Adding the canvas (app.view) to DOM

 

Before moving away from the game screen I'm:

-Destroying resources and resetting the PIXI.loader

-Removing the canvas (app.view) from DOM

 

Most of the time everything works fine, but rarely when I'm moving away from the game screen I'm getting the following error:

Quote

Runtime Error

Cannot read property 'width' of null
Stack
TypeError: Cannot read property 'width' of null at Image.e.calculateVertices (http://localhost:8100/assets/imageSwapper/pixi.min.js:14:13368) at Image.e._renderWebGL (http://localhost:8100/assets/imageSwapper/pixi.min.js:14:14230) at Image.e.renderWebGL (http://localhost:8100/assets/imageSwapper/pixi.min.js:10:21822) at Swapper.e.renderWebGL (http://localhost:8100/assets/imageSwapper/pixi.min.js:10:21898) at e.renderWebGL (http://localhost:8100/assets/imageSwapper/pixi.min.js:10:21898) at e.render (http://localhost:8100/assets/imageSwapper/pixi.min.js:13:8590) at t.render (http://localhost:8100/assets/imageSwapper/pixi.min.js:10:10909) at t.emit (http://localhost:8100/assets/imageSwapper/pixi.min.js:16:7855) at t.update (http://localhost:8100/assets/imageSwapper/pixi.min.js:16:6834) at _tick (http://localhost:8100/assets/imageSwapper/pixi.min.js:16:5017) at t.invokeTask (http://localhost:8100/build/polyfills.js:3:12256) at Object.onInvokeTask (http://localhost:8100/build/main.js:4539:37) at t.invokeTask (http://localhost:8100/build/polyfills.js:3:12177) at n.runTask (http://localhost:8100/build/polyfills.js:3:7153) at invoke (http://localhost:8100/build/polyfills.js:3:13213)

I don't know yet why this error only rarely occurs and why. What do you think?

Link to comment
Share on other sites

  • 5 weeks later...

I finally have an unminified stacktrace (pixi.js - v4.5.3):

Quote

core.es5.js:1084 ERROR TypeError: Cannot read property 'width' of null
    at Image.calculateVertices (Sprite.js:211)
    at Image._renderWebGL (Sprite.js:295)
    at Image.renderWebGL (Container.js:409)
    at Swapper.renderWebGL (Container.js:414)
    at Container.renderWebGL (Container.js:414)
    at WebGLRenderer.render (WebGLRenderer.js:318)
    at Application.render (Application.js:128)
    at TickerListener.emit (TickerListener.js:78)
    at Ticker.update (Ticker.js:394)
    at Ticker._tick (Ticker.js:113)
    at t.invokeTask (polyfills.js:3)
    at Object.onInvokeTask (core.es5.js:4116)
    at t.invokeTask (polyfills.js:3)
    at n.runTask (polyfills.js:3)
    at invoke (polyfills.js:3)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...