TypeError: this._bitmap is null

I kept getting this message randomly at the start of my game


"TypeError: this._bitmap is null"


I say randomly because, for example: it would come up I would delete an event and it would stop and then after 2 more play test it would come back up.


Not really understanding what was going on I just minimised the parallel process's going on and after a while I got it to work consistently with no fault.


I have just deployed the game for my website through my FTP and the version I have local works with no fault, but the copy that is now being hosted online is displaying the error in the exact same way it was happening previously.


What does this error really mean? How can you pin point the problem generally? How can you pin point problems with hosted games?


Cheers

Screen Shot 2016-12-16 at 20.30.30.png
It looks like as if a picture file is missing.


Please tell us, what do you mean "at start"?


Does the main menu come up, press start game and THEN it happens, or just by launching it you get the error?


It is important to know, so we can track which file involved is missing or renamed by accident (I suppose)


It's an asset set up on the Database. It can be a sprite, a picture. Let me see..



Sprite.prototype._onBitmapLoad = function()


Yeah... line 3666 is about sprites. Take a look at your eventing and database, calling an invalid name of a spritesheet.


P.S > Screenshot picture was somewhat helpful! Thus the like! 🙂


Edit: Adding a few more stuff:

What does this error really mean? How can you pin point the problem generally? How can you pin point problems with hosted games?





I use notepas++ to see code.


At the js folder of your game a file named rpg_core.js exists.


Opening it with such an editor, going to the line 3666 you see this:


/**
 * @method _onBitmapLoad
 * @private
 */

Sprite.prototype._onBitmapLoad = function() {
    if (this._frame.width === 0 && this._frame.height === 0) {
        this._frame.width = this._bitmap.width;
        this._frame.height = this._bitmap.height;
    }
    this._refresh();
};


The green part is a description of the method.


The blue part says that we talk about sprites, and we talk about an incident that a Bitmap file will be loaded. Thus we can assume it is about loading the graphics of the sprite.


The purple part is the part that the problem occurs.


null means no value.


So either you got a bitmap with no width at all, that is probably impossible OR the code could not find the bitmap with that name.


I am not VERY experienced with JS but first I hope I am right and secondly I hope I helped you understand what is going on. 🙂
It was the first scene after the menu.


I have managed to solve the problem but it has nothing to do with images which is why is confusing. At the beginning of the game I have a common event to set up all my consistent variables, player X, Y etc.


By changing the common event to not be started right at the beggining but after the first line of text I now no longer have the problem......o_0     XD      o_0
By changing the common event to not be started right at the beggining but after the first line of text I now no longer have the problem......o_0     XD      o_0



Wat.jpg



No, no, no! Can we have a look at this common event and maybe any other event involved?


This is interesting.


Edit:


Even the rest of the code lines,like 1287 seem involved with the bitmap prototype (prototypes are like classes in Java, please don't ask me what a class is, it's late at night!) 😛


@Shaz any ideas?
??? no images involved at all. Them main reason I knew it had nothing to do with images is 1 because all images are accounted for and 2 because it didn't happen every time, surely by its own diagnosis if everything was kept the same it shouldn't of work just by resetting.

Screen Shot 2016-12-16 at 21.42.19.png
I can only make assumptions here... Player X and Player Y is set here as Map X of Player and Map Y of player. If Map X of Playe wasn't loaded before the first line of the text, then it might occur. It deserves a heads up.


So you called this at start and it returns the error, then you edited your game to call it after the first line of text and is doesn't. Right?


I will try to reproduce it to see what happens.
Yes that's correct, I had an event to walk towards the player following the variables of 7 & 8, by having that commence after her first line of dialog it solved that particular problem
I will try to reproduce it to see what happens.



Negative. I can NOT make it crash no matter what. So maybe something else is happening. Can you please tell me if you are using any extra plugins? Especially any plugins about parallax mapping. Also, do you show any pictures on maps, like a fog effect or a parallax background or something? 🙂  


Any HUD, any other picture involved?
Soooo many plugins, Only relevant would be Mogs Weather which is not activated till the very end of the game.
I am not sure, but by telling me...

 which is not activated till the very end of the game.



...did you probably meant "not used till the very end of the game"?


I think you either have a plugin active or inactive during the whole proccess of the game. I might be wrong of course, but not sure on that.


I wonder if you also include pictures and parallax mapping on your maps. Do you?


In any case, I am glad your case is solved, but you know, having an unanswered questions makes me lose my sleep just beacuse of my curiosity! 😛
What's in the event that calls the common event?  Please show the WHOLE event window, and do not crop it to just the commands like you've done with the screenshot above.


It's something about images, and maybe one of your plugins is not allowing for the fact that images don't load immediately and might take some time for the stats to be available.  Your calling the common event AFTER the first line of text allows the image time to be loaded.  But as you say, there's nothing in that common event that does any image stuff, so I'm guessing there's something else going on, either in the event that calls it, or other events that run as parallel processes and maybe do plugin stuff.
It's something about images, and maybe one of your plugins is not allowing for the fact that images don't load immediately and might take some time for the stats to be available.



Yeah I thought of that, but could not reproduce it.
The event that calls the common event was changed multiple times, this was the first thing I tested. Then I checked different pages with no effect. After I minimised the amount of parallel processes (which was good anyway) and Identified the particular set of events causing the problem (it was obviously something at the very start of one of them), I turned off every other parallel process to make sure it was a parallel overload, then after finding the event (it was the main one) I took out each element one by one and sure enough it's the command to turn on that common event that was causing the problem.


Since I have been testing it has happened again twice so previously it was happening about 1 in 3 times now its like 1 in 50-100


Most likely it is a plugin but because its not related to anything in those variables I think its very unlikely I will find it...saying that if I had to guess I would say its Mog's Character Particles
Any chance switch 20 is being used by one of the plugins, or by other events set to autorun or parallel process?


Also ...


- do you have the latest version of MV?


- have you correctly updated your project to the latest version of MV (involves copying index.html and the javascript library from the MV install folder's NewData into your project, making sure you copy away your plugins.js file and put it back again afterwards)


- are all of your plugins the latest versions available?


If it continues to happen, or if you can make it happen reliably, and are happy to zip up your project and share, I can take a look through it and see if I can find the cause of the problem.  I don't want to have to play 50 times to make it happen though - you'd need to get it back to the 1 in 3 times.

Original thread: https://forums.rpgmakerweb.com/threads/typeerror-this-_bitmap-is-null.72382/