FakeFishGames / Barotrauma

A 2D online multiplayer game taking place in a submarine travelling through the icy depths of Jupiter's moon Europa.
http://www.barotraumagame.com/
1.77k stars 409 forks source link

Exception: Value cannot be null. (Parameter 'texture') (System.ArgumentNullException) #5663

Closed Krzeszny closed 3 years ago

Krzeszny commented 3 years ago

Description The game crashed when I was alt-tabbed.

Steps To Reproduce ???

Version 0.13.3.11 Windows 10 Pro 20H2

Additional information crashreport (3).log Co-op with one mod: Thalassophobia



Target site: Void CheckValid(Microsoft.Xna.Framework.Graphics.Texture2D)
Stack trace: 
   at Microsoft.Xna.Framework.Graphics.SpriteBatch.CheckValid(Texture2D texture) in <DEV>\Libraries\MonoGame.Framework\Src\MonoGame.Framework\Graphics\SpriteBatch.cs:line 178
   at Microsoft.Xna.Framework.Graphics.SpriteBatch.Draw(Texture2D texture, Vector2 position, Nullable`1 sourceRectangle, Color color, Single rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, Single layerDepth) in <DEV>\Libraries\MonoGame.Framework\Src\MonoGame.Framework\Graphics\SpriteBatch.cs:line 398
   at Barotrauma.Decal.Draw(SpriteBatch spriteBatch, Hull hull, Single depth) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Decals\Decal.cs:line 19
   at Barotrauma.Hull.DrawDecals(SpriteBatch spriteBatch) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Map\Hull.cs:line 230
   at Barotrauma.Hull.Draw(SpriteBatch spriteBatch, Boolean editing, Boolean back) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Map\Hull.cs:line 338
   at Barotrauma.Submarine.DrawBack(SpriteBatch spriteBatch, Boolean editing, Predicate`1 predicate) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Map\Submarine.cs:line 375
   at Barotrauma.GameScreen.DrawMap(GraphicsDevice graphics, SpriteBatch spriteBatch, Double deltaTime) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Screens\GameScreen.cs:line 232
   at Barotrauma.GameScreen.Draw(Double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Screens\GameScreen.cs:line 124
   at Barotrauma.GameMain.Draw(GameTime gameTime) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\GameMain.cs:line 1031
   at Microsoft.Xna.Framework.Game.DoDraw(GameTime gameTime) in <DEV>\Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 669
   at Microsoft.Xna.Framework.Game.Tick() in <DEV>\Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 511
   at Microsoft.Xna.Framework.SdlGamePlatform.RunLoop() in <DEV>\Libraries\MonoGame.Framework\Src\MonoGame.Framework\SDL\SDLGamePlatform.cs:line 94
   at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior) in <DEV>\Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 398
   at Microsoft.Xna.Framework.Game.Run() in <DEV>\Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 368
   at Barotrauma.Program.Main(String[] args) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Program.cs:line 59```
Regalis11 commented 3 years ago

Hard to say what caused this, but one explanation could be that Thalassophobia includes some kind of a custom decal with an invalid sprite path. In any case, I added a null check to prevent this from crashing the game https://github.com/Regalis11/Barotrauma-development/commit/60ae1e1e61cf568eae8249dd6023aedc20bd5348

Rokvach commented 3 years ago

Tested, seems to be working correctly. Closing.