Commit 6dc96aa7455d00a3556618a4a459851424ae5d44

Ozkan Sezer 2022-11-18T18:02:10

SDL_UDEV_DelCallback: return early if _this is NULL Fixes https://github.com/libsdl-org/SDL/issues/6548

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/src/core/linux/SDL_udev.c b/src/core/linux/SDL_udev.c
index 311cdd1..85cde89 100644
--- a/src/core/linux/SDL_udev.c
+++ b/src/core/linux/SDL_udev.c
@@ -545,6 +545,10 @@ SDL_UDEV_DelCallback(SDL_UDEV_Callback cb)
     SDL_UDEV_CallbackList *item;
     SDL_UDEV_CallbackList *prev = NULL;
 
+    if (_this == NULL) {
+        return;
+    }
+
     for (item = _this->first; item != NULL; item = item->next) {
         /* found it, remove it. */
         if (item->callback == cb) {