Closed zpxp closed 2 years ago
Cant post an example as application is too complex but if you try to destroy a scene with a sizer without children, it freezes the game.
This function GetChildrenSizers should have an if check on the children variable before it tries to iterate it.
GetChildrenSizers
children
Before:
var GetChildrenSizers = function(out) { if (out === undefined) { out = []; } var children = this.sizerChildren, child; for (var i = 0, cnt = children.length; i < cnt; i++) { child = children[i]; if (child.isRexSizer) { out.push(child); } } return out; } export default GetChildrenSizers;
After:
var GetChildrenSizers = function(out) { if (out === undefined) { out = []; } var children = this.sizerChildren, child; if(children) { for (var i = 0, cnt = children.length; i < cnt; i++) { child = children[i]; if (child.isRexSizer) { out.push(child); } } } return out; } export default GetChildrenSizers;
Error:
GetChildrenSizers.js:7 Uncaught TypeError: Cannot read properties of undefined (reading 'length') -- | -- | -- | GetChildrenSizers | @ | GetChildrenSizers.js:7 | GetAllChildrenSizers | @ | GetAllChildrenSizers.js:6 | GetAllChildrenSizers | @ | GetAllChildrenSizers.js:9 | GetAllChildrenSizers | @ | GetAllChildrenSizers.js:9 | GetAllChildrenSizers | @ | GetAllChildrenSizers.js:9 | destroy | @ | BaseSizer.js:39 | shutdown | @ | phaser.js:166925 | emit | @ | phaser.js:1928 | shutdown | @ | phaser.js:49454 | stop | @ | phaser.js:100949 | processQueue | @ | phaser.js:100024 | update | @ | phaser.js:100278 | step | @ | phaser.js:162805 | step | @ | phaser.js:89366 | step | @ | phaser.js:89613 | requestAnimationFrame (async) | | | step | @ | phaser.js:89615
This bug had been fixed in this commit, npm package will upgrade at end of this month.
Cant post an example as application is too complex but if you try to destroy a scene with a sizer without children, it freezes the game.
This function
GetChildrenSizers
should have an if check on thechildren
variable before it tries to iterate it.Before:
After:
Error: