From 03f8528315fa46c95991a34f3325d7b33ae5538c Mon Sep 17 00:00:00 2001
From: Edward Rudd <urkle@outoforder.cc>
Date: Sat, 02 May 2020 21:48:36 +0000
Subject: [PATCH] Update source to SDL2 2.0.12

---
 source/src/sensor/SDL_sensor.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/source/src/sensor/SDL_sensor.c b/source/src/sensor/SDL_sensor.c
index 5c7a990..68c3b1f 100644
--- a/source/src/sensor/SDL_sensor.c
+++ b/source/src/sensor/SDL_sensor.c
@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+  Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -486,7 +486,7 @@
     /* Post the event, if desired */
     posted = 0;
 #if !SDL_EVENTS_DISABLED
-    if (SDL_GetEventState(SDL_JOYAXISMOTION) == SDL_ENABLE) {
+    if (SDL_GetEventState(SDL_SENSORUPDATE) == SDL_ENABLE) {
         SDL_Event event;
         event.type = SDL_SENSORUPDATE;
         event.sensor.which = sensor->instance_id;
@@ -503,7 +503,11 @@
 SDL_SensorUpdate(void)
 {
     int i;
-    SDL_Sensor *sensor;
+    SDL_Sensor *sensor, *next;
+
+    if (!SDL_WasInit(SDL_INIT_SENSOR)) {
+        return;
+    }
 
     SDL_LockSensors();
 
@@ -527,7 +531,8 @@
     SDL_updating_sensor = SDL_FALSE;
 
     /* If any sensors were closed while updating, free them here */
-    for (sensor = SDL_sensors; sensor; sensor = sensor->next) {
+    for (sensor = SDL_sensors; sensor; sensor = next) {
+        next = sensor->next;
         if (sensor->ref_count <= 0) {
             SDL_SensorClose(sensor);
         }

--
Gitblit v1.9.3