Преглед изворни кода

wayland: Check the returned display value for null

In reality, this condition will never occur, since the index is checked before calling the display retrieval function, but aggressive LTO with jump threading can generate a warning if this isn't explicitly checked.
Frank Praznik пре 1 година
родитељ
комит
91bb1bb6fd
1 измењених фајлова са 5 додато и 0 уклоњено
  1. 5 0
      src/video/wayland/SDL_waylandvideo.c

+ 5 - 0
src/video/wayland/SDL_waylandvideo.c

@@ -647,6 +647,11 @@ static void display_handle_done(void *data,
 
 
     if (driverdata->index > -1) {
     if (driverdata->index > -1) {
         dpy = SDL_GetDisplay(driverdata->index);
         dpy = SDL_GetDisplay(driverdata->index);
+
+        /* XXX: This can never happen, but jump threading during aggressive LTO can generate a warning without this check. */
+        if (!dpy) {
+            dpy = &driverdata->placeholder;
+        }
     } else {
     } else {
         dpy = &driverdata->placeholder;
         dpy = &driverdata->placeholder;
     }
     }