[MV] Game crash when using items

Hello. So I've ran into a problem with a game I'm making and i have no idea what has caused this issue to happen. The issue being that whenever I use an item in battle, the game just crashes. 

Here's the error message I get:
1b05c0f856a2fc64c26b2e284ee4524d.png

https://gyazo.com/1b05c0f856a2fc64c26b2e284ee4524d


Here is also the console log I get when the error happens:
TypeError: Failed to execute 'createLinearGradient' on 'CanvasRenderingContext2D': float parameter 3 is non-finite.
    at TypeError (native)
    at Bitmap.gradientFillRect (file:///D:/RPGMakerMV/Games/TNQ/js/rpg_core.js:781:24)
    at Bitmap.gradientFillRect (file:///D:/RPGMakerMV/Games/TNQ/js/plugins/YEP_CoreEngine.js:622:41)
    at Window_BattleStatus.Window_Base.drawGauge (file:///D:/RPGMakerMV/Games/TNQ/js/plugins/YEP_CoreEngine.js:1449:17)
    at Window_BattleStatus.Window_Base.drawActorHp (file:///D:/RPGMakerMV/Games/TNQ/js/rpg_windows.js:555:10)
    at Window_BattleStatus.drawGaugeArea (file:///D:/RPGMakerMV/Games/TNQ/js/plugins/YEP_BattleStatusWindow.js:498:10)
    at Window_BattleStatus.drawItem (file:///D:/RPGMakerMV/Games/TNQ/js/plugins/YEP_BattleStatusWindow.js:468:10)
    at Window_BattleStatus.processStatusRefresh (file:///D:/RPGMakerMV/Games/TNQ/js/plugins/YEP_BattleEngineCore.js:5021:10)
    at Window_BattleStatus.updateStatusRequests (file:///D:/RPGMakerMV/Games/TNQ/js/plugins/YEP_BattleEngineCore.js:5012:50)
    at Scene_Battle.updateStatusWindowRequests (file:///D:/RPGMakerMV/Games/TNQ/js/plugins/YEP_BattleEngineCore.js:4283:24)

If anyone knows how I can fix this then I really appreciate any help. 🙂
Something has gone wrong with your plugins. Something that should be a number is becoming infinite, which is likely the result of a division by 0, or something equally invalid in regular mathematics. Check your configuration for Yanfly's plugins, since those are directly named in the stack trace, and see if you can find anything out of place.
Something has gone wrong with your plugins. Something that should be a number is becoming infinite, which is likely the result of a division by 0, or something equally invalid in regular mathematics. Check your configuration for Yanfly's plugins, since those are directly named in the stack trace, and see if you can find anything out of place.


I couldn't find what was wrong with the plugins I was using but I've just noticed that the error still happens after turning off all my plugins as well. So I'm unsure on if it is a problem caused by plugins or if it is something else.

Error log without the plugins:
TypeError: Failed to execute 'createLinearGradient' on 'CanvasRenderingContext2D': float parameter 3 is non-finite.
    at TypeError (native)
    at Bitmap.gradientFillRect (file:///D:/RPGMakerMV/Games/TNQ/js/rpg_core.js:781:24)
    at Window_BattleStatus.Window_Base.drawGauge (file:///D:/RPGMakerMV/Games/TNQ/js/rpg_windows.js:469:19)
    at Window_BattleStatus.Window_Base.drawActorHp (file:///D:/RPGMakerMV/Games/TNQ/js/rpg_windows.js:555:10)
    at Window_BattleStatus.drawGaugeAreaWithTp (file:///D:/RPGMakerMV/Games/TNQ/js/rpg_windows.js:5518:10)
    at Window_BattleStatus.drawGaugeArea (file:///D:/RPGMakerMV/Games/TNQ/js/rpg_windows.js:5511:14)
    at Window_BattleStatus.drawItem (file:///D:/RPGMakerMV/Games/TNQ/js/rpg_windows.js:5484:10)
    at Window_BattleStatus.Window_Selectable.drawAllItems (file:///D:/RPGMakerMV/Games/TNQ/js/rpg_windows.js:1250:18)
    at Window_BattleStatus.refresh (file:///D:/RPGMakerMV/Games/TNQ/js/rpg_windows.js:5478:10)
    at Function.BattleManager.refreshStatus (file:///D:/RPGMakerMV/Games/TNQ/js/rpg_managers.js:2046:24)
Ok, then check your damage formulas. Maybe you're doing something that ends up diving by 0 or something equally as invalid.
Ok, then check your damage formulas. Maybe you're doing something that ends up diving by 0 or something equally as invalid.


Ah, I think I've figured out the issue. Some of my items had 0% Variance which I think was the problem since changing that fixed the issue. 
Thanks for the help though. 🙂
@Sowhart


Variance 0 will not make a problem in an intact project - if changing variance to non-zero everywhere solves the problem, then some of the code got damaged or became incompatible.


1) did you start a new game before those tests or did you load a saved game? Especially after turning off all plugins?


Some data is stored in the savefile, and whenever something changed on the plugins, you need to start a new game to prevent errors such as the one you had.


2) another cause for this class of errors might be incompatibilites between different file versions.


This should not happen if all plugins are turned off and a new game is started, but in any other case it can happen if the plugins and core files are from different versions of the editor, you should update everything to the latest version (after a backup in case one of your plugins is not yet compatible with the newest versions of the core engine)

Original thread: https://forums.rpgmakerweb.com/threads/mv-game-crash-when-using-items.72223/