Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 73680ab
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/events/SDL_dropevents.c
Expand Up @@ -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;
Expand Down

0 comments on commit 73680ab

Please sign in to comment.