summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-11-13 15:52:42 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-11-13 15:52:42 +0100
commitb05e1e7d6982c1a0ebbba2e1da60bf05fd2a009a (patch)
tree9b4a70af78c6e7beeb16a66e969045ee01e4a56b
parentcc178b9e4db835a18a8ffb1ebd715e7d4e0ca033 (diff)
parent4c8409c0fe2a06dd7fa0ff0fde428298b4b18e2d (diff)
Merge pull request #68608 from dsnopek/gl-manager-nullptr
Added missing null checks for gl_manager in MacOS and Windows display servers
-rw-r--r--platform/macos/display_server_macos.mm5
-rw-r--r--platform/windows/display_server_windows.cpp10
2 files changed, 12 insertions, 3 deletions
diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm
index 8b596379a0..e8a56c984c 100644
--- a/platform/macos/display_server_macos.mm
+++ b/platform/macos/display_server_macos.mm
@@ -2945,7 +2945,10 @@ int64_t DisplayServerMacOS::window_get_native_handle(HandleType p_handle_type, W
}
#ifdef GLES3_ENABLED
case OPENGL_CONTEXT: {
- return (int64_t)gl_manager->get_context(p_window);
+ if (gl_manager) {
+ return (int64_t)gl_manager->get_context(p_window);
+ }
+ return 0;
}
#endif
default: {
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index 2c8058fdc5..ec6a8d5579 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -743,10 +743,16 @@ int64_t DisplayServerWindows::window_get_native_handle(HandleType p_handle_type,
}
#if defined(GLES3_ENABLED)
case WINDOW_VIEW: {
- return (int64_t)gl_manager->get_hdc(p_window);
+ if (gl_manager) {
+ return (int64_t)gl_manager->get_hdc(p_window);
+ }
+ return 0;
}
case OPENGL_CONTEXT: {
- return (int64_t)gl_manager->get_hglrc(p_window);
+ if (gl_manager) {
+ return (int64_t)gl_manager->get_hglrc(p_window);
+ }
+ return 0;
}
#endif
default: {