80O / PlusEMU

37 stars 28 forks source link

NullReferenceException when switching between rooms #177

Closed lkrle closed 1 year ago

lkrle commented 1 year ago

When switching between rooms an Exception is raised at RoomUserManager.cs:line 282 When continuing you will enter the room without any problems.

  1. Enter a room
  2. Switch to another room
  3. Boom.

Exception: System.NullReferenceException: Object reference not set to an instance of an object. at Plus.HabboHotel.Rooms.RoomUserManager.RemoveUserFromRoom(GameClient session, Boolean nofityUser, Boolean notifyKick)

lkrle commented 1 year ago

The Exception also happens when a User disconnects.

Diddyy commented 1 year ago

I need to set back up a local dev environment so I can have a deeper look but looks like it is potentially an issue with this line. dbClient.Execute("UPDATE user_roomvisits SET exit_timestamp = @exitTimestamp WHERE room_id = @roomId AND user_id = @userId ORDER BY exit_timestamp DESC LIMIT 1",

80O commented 1 year ago

The whole Room session management workflow needs to be refactored. Currently there are too many places that handle the state of the player in the room. Also the player is not actively removed when switching to another room but rather just removed after a certain room cycle timeout.

80O commented 1 year ago

Resolved for now.