Skip to content

Fix rare crash with logs#2161

Merged
peace-maker merged 3 commits intoalliedmodders:masterfrom
Kenzzer:crash_log
May 24, 2024
Merged

Fix rare crash with logs#2161
peace-maker merged 3 commits intoalliedmodders:masterfrom
Kenzzer:crash_log

Conversation

@Kenzzer
Copy link
Member

@Kenzzer Kenzzer commented May 19, 2024

Issue mentioned to Asherkin or Psychonic.

Long story short, if a metamod plugin happens to be detouring some game functions that SM unfortunately calls while initialising, and decides to have the console print something. It will trigger FileFileNatives::LogPrint, however by that point g_pLogHook has not yet been initialised, it's still a nullptr. This of course ends up with a nullpointer crash.

Let's add a member property that tracks whether or not we've been initialised. nullcheck g_pLogHook

Copy link
Member

@asherkin asherkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - I think checking Add/RemoveLogHook was sane too, but is indeed unlikely to be necessary.

@peace-maker peace-maker merged commit 4e73713 into alliedmodders:master May 24, 2024
@Kenzzer Kenzzer deleted the crash_log branch June 2, 2024 12:27
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.

4 participants