SpikeHimself / XPortal

XPortal is a Valheim mod that lets you select a portal's destination from a list. XPortal is a complete rewrite of AnyPortal.
GNU General Public License v3.0
19 stars 6 forks source link

NullReferenceException when logging out #73

Open mischab1 opened 11 months ago

mischab1 commented 11 months ago

Describe the bug A NullReferenceException shows up in the console if you log out of your world while the crosshair is pointing at a portal and showing the portal's Name and Destination

To Reproduce Start world, look at a portal so it's Name and Destination are visible. Log out of the world

Expected behaviour no error

LogOutput file(s) See lines 397-401 in attached LogOutput file (lines 12-13 in StepsTaken file)

Version 1.2.17

Environment Steam version of Valheim via Thunderstore 1.32.2. Worlds are saved to cloud.

Other mods BepInExPack_Valheim v5.4.2200 Jotunn v2.14.3 Official_BepInEx_ConfigurationManager v18.0.1

Priority Low (XPortal is still working fine, error only seen in console, not otherwise noticeable.)

ex1 LogOutput.log ex1 StepsTaken.txt Thunderstore Mod List

SpikeHimself commented 11 months ago

If it's this part you're referring to:

[Info   : Unity Log] ZPlayFabMatchmaking::UnregisterServer - unregistering server now. State: Uninitialized
[Debug  :XPortal.Log] [TeleportWorld_GetHoverText.Prefix]  Shutting down, ignoring hover
[Error  : Unity Log] NullReferenceException: Object reference not set to an instance of an object
Stack trace:
Hud.UpdateCrosshair (Player player, System.Single bowDrawPercentage) (at <885fde5117a141d19eed8c0292c3d1fd>:0)
Hud.Update () (at <885fde5117a141d19eed8c0292c3d1fd>:0)

That error is not coming from XPortal.

mischab1 commented 11 months ago

The error goes away if I disable XPortal but leave Jotunn & BepInEx. So my assumption was that when XPortal says it's ignoring TeleportWorld_GetHoverText.Prefix because the world is being shutdown, that XPortal's override of the portal text is returning a NullReference to Valheim's Hud.UpdateCrosshair which can't handle it.

SpikeHimself commented 11 months ago

That's correct, XPortal detects that the game is shutting down, and as such does not execute the GetHoverText functionality, thereby preventing it from causing such an error (that's the intention, anyway!)

Are you running any other mods at all when you do this?

mischab1 commented 11 months ago

Just BepInExPack, Jotunn, & BepInEx ConfigurationManager.