Skip to content

Conversation

@cH1yoi
Copy link
Contributor

@cH1yoi cH1yoi commented Nov 12, 2024

L 11/13/2024 - 00:53:35: [SM] Exception reported: Invalid convar handle 41400405 (error 3)
L 11/13/2024 - 00:53:35: [SM] Blaming: match_vote.smx
L 11/13/2024 - 00:53:35: [SM] Call stack trace:
L 11/13/2024 - 00:53:35: [SM] [0] ConVar.SetInt
L 11/13/2024 - 00:53:35: [SM] [1] Line 102, x:\GitHub\L4D2-Competitive-Rework\addons\sourcemod\scripting\match_vote.sp::OnPluginEnd

This occurred because the plugin was trying to access ConVar handles that had already been cleaned up by SourceMod during the unload process.

Solution

  • Added ConVar handle validity checks in Listener_Quit to reset sv_maxplayers before server shutdown
  • Improved handle management to prevent accessing invalid handles during plugin unload
  • Added safety checks to prevent potential null pointer access

Technical Details

  • Moved the primary sv_maxplayers reset logic to Listener_Quit which triggers before server shutdown
  • Added null checks for ConVar handles before attempting to modify their values
  • Used g_bShutdown flag to track proper shutdown sequence

While this error was mostly cosmetic and didn't affect core functionality, this fix provides a cleaner shutdown process and eliminates error messages in server logs.

@cH1yoi cH1yoi closed this Nov 12, 2024
@cH1yoi
Copy link
Contributor Author

cH1yoi commented Nov 12, 2024

There are still some minor issues

@cH1yoi cH1yoi deleted the patch-1 branch November 12, 2024 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant