SabreML / MusicAnnouncements

A mod for Rain World which shows the name of the currently playing music track in-game.
2 stars 0 forks source link

Game crashed because of this mod. #2

Open cryomaniac42 opened 5 months ago

cryomaniac42 commented 5 months ago

NullReferenceException: Object reference not set to an instance of an object Music.MusicPiece+SubTrack.Update () (at :0) Music.MusicPiece.Update () (at :0) Music.Song.Update () (at :0) (wrapper dynamic-method) Music.MusicPlayer.DMD(Music.MusicPlayer) (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition.Trampoline?-1878146560(Music.MusicPlayer) MusicAnnouncements.MusicAnnouncementsMod.MusicPlayer_UpdateHK (On.Music.MusicPlayer+orig_Update orig, Music.MusicPlayer self) (at :0) (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition.Hook?95147008(Music.MusicPlayer) MainLoopProcess.RawUpdate (System.Single dt) (at :0) ProcessManager.Update (System.Single deltaTime) (at :0) RainWorld.Update () (at :0)

I was doing a SB_S07>>>SB_S05, and after sleeping in a SB_S05 shelter the game crashed with this exception. Other mods are: Sharpener, Remix, Merge Fix, DMS, Input Display, Deathcount.

SabreML commented 5 months ago

Thank you for the report! (especially for giving so much information!)

I tried doing the same SB_S07 > SB_S05 route with your modlist (playing as monk), but unfortunately I wasn't able to reproduce the crash on my end. I could still run around and everything without any issues after I slept in the shelter.

Since the exception is music-related, it definitely seems like it's coming from this mod, but I'm not really sure what part could have caused it. There is a call to the mod's MusicPlayer_UpdateHK() method (code below) in the middle of the stack trace, but as far as I can tell when the crash happened it had only got as far as the orig() call right at the start, which itself calls the '(wrapper dynamic-method)' stuff, then the game's standard behaviour of Music.Song.Update() > Music.MusicPiece.Update() > Music.MusicPiece+SubTrack.Update(). https://github.com/SabreML/MusicAnnouncements/blob/ff2034faa97dd6a26412b55abfc85ea1c311ce2f/src/MusicAnnouncementsMod.cs#L112-L131 The actual crash seems to have happened somewhere in Rain World's built-in Music.MusicPiece.SubTrack.Update() method, since that's the last thing in the exception's stack trace.

Like I said I'm sure the mod had something to do with the crash, since AFAIK this isn't an issue in the basegame and Music Announcements is presumably the only one of your mods that's messing with the game's music system, but I haven't had much luck figuring it out so far.