Skip to content

fix(main): Guard TheMouse and TheGlobalData against null in WndProc - #670

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/wndproc-null-guards
Open

sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/wndproc-null-guards

Conversation

@sentry

@sentry sentry Bot commented Oct 26, 2026

Copy link
Copy Markdown

Fixes null-pointer dereferences in the main Win32 window procedure (WndProc) when Windows messages are pumped during early engine initialization or shutdown before subsystems have finished initializing.

Changes:

  • GeneralsMD/Code/Main/WinMain.cpp and Generals/Code/Main/WinMain.cpp:
    • Guard WM_MOUSEMOVE with TheMouse == nullptr in addition to TheWin32Mouse == nullptr, preventing null calls into TheMouse->isCursorInside(), onCursorMovedInside(), and onCursorMovedOutside().
    • Guard WM_NCHITTEST and WM_SYSCOMMAND with if (TheGlobalData && !TheGlobalData->m_windowed) instead of reading TheGlobalData->m_windowed unguarded.

Related to Sentry issue CLIENT-58M (null dereference in WndProc during GameEngine::init).

Fixes CLIENT-58M

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry. You can adjust this setting at any time.

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.

0 participants