Skip to content

Commit

Permalink
Fix potential crash with eglGetDisplay
Browse files Browse the repository at this point in the history
  • Loading branch information
Etaash-mathamsetty committed Dec 8, 2024
1 parent 85035c9 commit 3b98624
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/gl/inject_egl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,16 @@ EXPORT_C_(void*) eglGetDisplay( void* native_display )
try
{
void** display_ptr = (void**)native_display;
wl_interface* iface = (wl_interface*)*display_ptr;
if(iface && strcmp(iface->name, wl_display_interface.name) == 0)
if (native_display)
{
wl_display_ptr = (struct wl_display*)native_display;
HUDElements.display_server = HUDElements.display_servers::WAYLAND;
wl_handle = real_dlopen("libwayland-client.so", RTLD_LAZY);
init_wayland_data();
wl_interface* iface = (wl_interface*)*display_ptr;
if(iface && strcmp(iface->name, wl_display_interface.name) == 0)
{
wl_display_ptr = (struct wl_display*)native_display;
HUDElements.display_server = HUDElements.display_servers::WAYLAND;
wl_handle = real_dlopen("libwayland-client.so", RTLD_LAZY);
init_wayland_data();
}
}
}
catch(...)
Expand Down

0 comments on commit 3b98624

Please sign in to comment.