From 7c9d8a0b99a9c7a601f15c0d1c5356055feb7aaf Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Thu, 26 Mar 2020 07:45:27 -0400 Subject: [PATCH] - fix nullptr crash in player.camera reference when player.camera is nullptr --- src/rendering/gl/renderer/gl_renderer.cpp | 3 ++- src/rendering/vulkan/system/vk_framebuffer.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rendering/gl/renderer/gl_renderer.cpp b/src/rendering/gl/renderer/gl_renderer.cpp index 49ea8b0f4..6b722ad71 100644 --- a/src/rendering/gl/renderer/gl_renderer.cpp +++ b/src/rendering/gl/renderer/gl_renderer.cpp @@ -256,7 +256,8 @@ sector_t *FGLRenderer::RenderView(player_t* player) NoInterpolateView = false; // Shader start time does not need to be handled per level. Just use the one from the camera to render from. - gl_RenderState.CheckTimer(player->camera->Level->ShaderStartTime); + if (player->camera) + gl_RenderState.CheckTimer(player->camera->Level->ShaderStartTime); // prepare all camera textures that have been used in the last frame. // This must be done for all levels, not just the primary one! for (auto Level : AllLevels()) diff --git a/src/rendering/vulkan/system/vk_framebuffer.cpp b/src/rendering/vulkan/system/vk_framebuffer.cpp index 96a8c1cd1..b49798f4a 100644 --- a/src/rendering/vulkan/system/vk_framebuffer.cpp +++ b/src/rendering/vulkan/system/vk_framebuffer.cpp @@ -404,7 +404,8 @@ sector_t *VulkanFrameBuffer::RenderView(player_t *player) NoInterpolateView = false; // Shader start time does not need to be handled per level. Just use the one from the camera to render from. - GetRenderState()->CheckTimer(player->camera->Level->ShaderStartTime); + if (player->camera) + GetRenderState()->CheckTimer(player->camera->Level->ShaderStartTime); // prepare all camera textures that have been used in the last frame. // This must be done for all levels, not just the primary one! for (auto Level : AllLevels())