Skip to content

Commit

Permalink
Avoid a crash when a tray without a menu is clicked on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sackzement authored and slouken committed Jan 27, 2025
1 parent 09f900f commit 6f098a9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/tray/windows/SDL_tray.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ LRESULT CALLBACK TrayWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar
case WM_TRAYICON:
if (LOWORD(lParam) == WM_CONTEXTMENU || LOWORD(lParam) == WM_LBUTTONUP) {
SetForegroundWindow(hwnd);
TrackPopupMenu(tray->menu->hMenu, TPM_BOTTOMALIGN | TPM_RIGHTALIGN, GET_X_LPARAM(wParam), GET_Y_LPARAM(wParam), 0, hwnd, NULL);

if (tray->menu) {
TrackPopupMenu(tray->menu->hMenu, TPM_BOTTOMALIGN | TPM_RIGHTALIGN, GET_X_LPARAM(wParam), GET_Y_LPARAM(wParam), 0, hwnd, NULL);
}
}
break;

Expand Down

0 comments on commit 6f098a9

Please sign in to comment.