Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArtifactEvent crashes the game if that item does not exist #13577

Closed
2 tasks done
A2ur3 opened this issue Mar 18, 2024 · 2 comments
Closed
2 tasks done

ArtifactEvent crashes the game if that item does not exist #13577

A2ur3 opened this issue Mar 18, 2024 · 2 comments
Assignees
Labels
Bug Something isn't working Code Programming task Crash Some issue that causes the game to crash. Modding Modding-related feature request or issue, or a bug that only occurs with mods

Comments

@A2ur3
Copy link

A2ur3 commented Mar 18, 2024

Disclaimers

  • I have searched the issue tracker to check if the issue has already been reported.
  • My issue happened while using mods.

What happened?

when ArtifactEvent tries to spawn a non-existing item, the game crashes
in my opinion, the game should skip this spawn instead of crashing the game

Reproduction steps

  1. create an ArtifactEvent spawning something that does not exist
  2. unlock and start a new round
  3. the game instantly crashed the moment level has been generated

Bug prevalence

Happens every time I play

Single player or multiplayer?

Single player

-

No response

Version

v1.2.8.0 (Winter Update hotfix 2)

-

No response

Which operating system did you encounter this bug on?

Windows

Relevant error messages and crash reports

Exception: Object reference not set to an instance of an object. (System.NullReferenceException)
Target site: Void .ctor(Barotrauma.ItemPrefab, Microsoft.Xna.Framework.Vector2, Barotrauma.Submarine, UInt16, Boolean)
Stack trace: 
   at Barotrauma.Item..ctor(ItemPrefab itemPrefab, Vector2 position, Submarine submarine, UInt16 id, Boolean callOnItemLoaded) in <DEV>\Barotrauma\BarotraumaShared\SharedSource\Items\Item.cs:line 1025
   at Barotrauma.ArtifactEvent.SpawnItem() in <DEV>\Barotrauma\BarotraumaShared\SharedSource\Events\ArtifactEvent.cs:line 81
   at Barotrauma.ArtifactEvent.Update(Single deltaTime) in <DEV>\Barotrauma\BarotraumaShared\SharedSource\Events\ArtifactEvent.cs:line 111
   at Barotrauma.EventManager.Update(Single deltaTime) in <DEV>\Barotrauma\BarotraumaShared\SharedSource\Events\EventManager.cs:line 892
   at Barotrauma.GameSession.Update(Single deltaTime) in <DEV>\Barotrauma\BarotraumaShared\SharedSource\GameSession\GameSession.cs:line 796
   at Barotrauma.GameScreen.Update(Double deltaTime) in <DEV>\Barotrauma\BarotraumaShared\SharedSource\Screens\GameScreen.cs:line 143
   at Barotrauma.GameMain.Update(GameTime gameTime) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\GameMain.cs:line 863
   at Microsoft.Xna.Framework.Game.DoUpdate(GameTime gameTime) in E:\Barotrauma-development\Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 656
   at Microsoft.Xna.Framework.Game.Tick() in E:\Barotrauma-development\Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 500
   at Microsoft.Xna.Framework.SdlGamePlatform.RunLoop() in E:\Barotrauma-development\Libraries\MonoGame.Framework\Src\MonoGame.Framework\SDL\SDLGamePlatform.cs:line 93
   at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior) in E:\Barotrauma-development\Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 397
   at Microsoft.Xna.Framework.Game.Run() in E:\Barotrauma-development\Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 367
   at Barotrauma.Program.Main(String[] args) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Program.cs:line 58

Last debug messages:
[03/18/2024 21:22:32] ‖color:#9370DB‖[Custom EventSet]‖color:end‖ Error in ArtifactEvent - couldn't find an item prefab with the identifier rust1artifact
[03/18/2024 21:22:32] ‖color:#9370DB‖[Custom EventSet]‖color:end‖ Error in ArtifactEvent - couldn't find an item prefab with the identifier rust2artifact
@Regalis11 Regalis11 added Bug Something isn't working Code Programming task Crash Some issue that causes the game to crash. Modding Modding-related feature request or issue, or a bug that only occurs with mods labels Mar 18, 2024
@Regalis11 Regalis11 self-assigned this Mar 18, 2024
@Regalis11
Copy link
Collaborator

Fixed in https://github.com/FakeFishGames/Barotrauma-development/commit/e7de0479ff8f5913930d920cd563d26fe4418170

@Jasontti Jasontti self-assigned this May 29, 2024
@Jasontti
Copy link
Collaborator

Tested in: https://github.com/FakeFishGames/Barotrauma-development/pull/5070/commits/52bf3d320703b6329832cf99af5e94b3f6bc7c10

Created an event that spawn artifacts, it gave no errors.
<ArtifactEvent identifier="testartifact" itemidentifier="skyholderartifact" />

Malformed the itemidentifier to noartifact and got error without crash
Error in ArtifactEvent - couldn't find an item prefab with the identifier notartifact

No issues found, closing ticket as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Code Programming task Crash Some issue that causes the game to crash. Modding Modding-related feature request or issue, or a bug that only occurs with mods
Projects
None yet
Development

No branches or pull requests

3 participants