Skip to content
Permalink
Browse files

Fixed NULL dereference on drop events with no window associated.

(such as when dropping a file onto an app's icon to launch.)

This bug caught by Clang's static analyzer.
  • Loading branch information
icculus committed Jan 7, 2016
1 parent 1c4c3f5 commit 73680ab3740392904a72309ccf3d7a6757a049cb
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/events/SDL_dropevents.c
@@ -43,7 +43,11 @@ SDL_SendDrop(SDL_Window *window, const SDL_EventType evtype, const char *data)
if (need_begin) {
SDL_zero(event);
event.type = SDL_DROPBEGIN;
event.drop.windowID = window->id;

if (window) {
event.drop.windowID = window->id;
}

posted = (SDL_PushEvent(&event) > 0);
if (!posted) {
return 0;

0 comments on commit 73680ab

Please sign in to comment.