SDL_PeepEvents errors are not handled
SDL_PeepEvents
is called here and it may return negative value if there is an error according to the documentation. Current approach may cause freeze, handling the same event twice or handling invalid event when negative value is returned because loop does not break in this case.
Need to find out what kind of errors it returns and decide based on that whether a single event should be simply ignored, loop should break, exception should be thrown etc.
Edited by elsid