Uncaught TypeError: cannot read property 'width' of null
Hello Echo,
I have found a bug in your in your Beast book that causes your game to crush whenever I Select the unknown data. I did make a screenshot of the Error information for a better visualization of the problem.
Comments (13)
-
-
- changed title to Uncaught TypeError: cannot read property 'width' of null
-
What do you exactly mean by: “(not just in the beast book)”. Does it mean other custom scenes in the Menu they similar to the beast book or the Menus in general?
-
It's not even related to the menu, it can happen randomly when leaving a building upon loading as well. We have been unable to pinpoint exactly what triggers this error, as it doesn't always occur under the same circumstances.
-
If anyone gets this error, please try to tell me the exact circumstances that triggered it, as I can't diagnose an error that I can't even trigger. It's been annoying me for awhile.
-
I would assume the dev console doesn’t give any Feedback at all am I right? I mean otherwise you would have been able to fix the Problem. Is that not so?
-
That's correct. The dev console does not provide enough information because the error is related to trying to access the width property of a bitmap that is not loaded. The point of failure is so far removed from the actual cause that's it's very difficult to pin down, especially since I can't reliably reproduce the problem.
-
You can believe, my brain is smoking dude and that maybe just as much as yours. Because it can be as good as everything and that with an experience of 10 years in several Game engines from RPG Maker up to Unreal Engine and Unity.
-
It's not just that the bitmap isn't "not loaded", the variable pointing to it has been set to null in advanced (or changed later on.)
The error would be Uncaught TypeError: cannot read property 'width' of undefined, if the bitmap failed entirely and didn't already have a variable set to be null.
Edit* Actually if the bitmap failed to load entirely it either crash saying the "image doesn't exist" or load a empty bitmap (which would still have the width, height params. I'm convinced somewhere in a script its either setting a bitmap to null, or setting a variable to null and forgetting to load a bitmap to it.
I'd try looking at plugins you have that set bitmaps to null and or start out set to null before trying to load any images. That could help pin point potential issues.
Also if your error isn't directly related to the menu, its likely a script that is active in every scene... so any scripts that aren't specifically scene based.
Maybe this helps narrow down the search.
-
So my current idea for a workaround should prevent it from crashing and instead set the offending bitmap to be a blank bitmap, which should help with narrowing it down if someone notices graphics missing. Unfortunately I have been unable to trigger the error on our computers.
-
- changed status to on hold
Possibly fixed in 1.1.2
-
That may work, as long as some script isn't setting a reference to a bitmap (or soon to be reference) to null.
If you have a bitmap like
this.bitmapFace = null;
and then forget to set a bitmap to it, or have it set as a bitmap, but then change it too null.
Then any reference checking for that bitmap will get the "null" value, and it will crash.
So as long as you either
A) change any bitmap set to null to a loadEmptyBitmap instead
or
B) (A better option) check if bitmap even exists before doing a check on it. Any scripts referencing a bitmap should have a if (bitmap) or if(!bitmap) return before accessing those properties
Issue is that you can't really do either unless you know which script is setting the bitmap to null in the first place. You could just do a quick search for = null within each plugin.
-
- changed status to closed
- Log in to comment
This is a known bug that seems to happen randomly (not just in the beast book). We have been trying to figure out why this bug occurs and are still looking into it.