diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml
index 13e5470a56e..2ffa4dc50ba 100644
--- a/doc/classes/RenderingServer.xml
+++ b/doc/classes/RenderingServer.xml
@@ -838,6 +838,8 @@
+ Creates a RenderingDevice that can be used to do draw and compute operations on a separate thread. Cannot draw to the screen nor share data with the global RenderingDevice.
+ [b]Note:[/b] When using the OpenGL backend or when running in headless mode, this function always returns [code]null[/code].
@@ -1273,6 +1275,8 @@
+ Returns the global RenderingDevice.
+ [b]Note:[/b] When using the OpenGL backend or when running in headless mode, this function always returns [code]null[/code].
diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp
index a18a9d7460f..6cb1684baf5 100644
--- a/servers/rendering_server.cpp
+++ b/servers/rendering_server.cpp
@@ -1476,7 +1476,11 @@ RenderingDevice *RenderingServer::get_rendering_device() const {
}
RenderingDevice *RenderingServer::create_local_rendering_device() const {
- return RenderingDevice::get_singleton()->create_local_device();
+ RenderingDevice *device = RenderingDevice::get_singleton();
+ if (!device) {
+ return nullptr;
+ }
+ return device->create_local_device();
}
static Vector[> _get_imgvec(const TypedArray &p_layers) {
]