From 182e53319d01668547a0edbeade3ea23e8d2d172 Mon Sep 17 00:00:00 2001 From: Kirides Date: Thu, 19 Dec 2019 23:04:29 +0100 Subject: [PATCH] v17.7-dev4. Add logging for if OnRemovedVob is called with nullptr args --- D3D11Engine/GothicAPI.cpp | 15 ++++++++++++++- D3D11Engine/pch.h | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/D3D11Engine/GothicAPI.cpp b/D3D11Engine/GothicAPI.cpp index 7b6c6acf..954dbae8 100644 --- a/D3D11Engine/GothicAPI.cpp +++ b/D3D11Engine/GothicAPI.cpp @@ -1141,6 +1141,19 @@ void GothicAPI::LeaveResourceCriticalSection() /** Called when a VOB got removed from the world */ void GothicAPI::OnRemovedVob(zCVob * vob, zCWorld * world) { + if (!vob) + { + // Should never happen! + LogError() << "OnRemovedVob called with vob = nullptr!"; + return; + } + if (!world) + { + // Same! + LogError() << "OnRemovedVob called with world = nullptr!"; + return; + } + //LogInfo() << "Removing vob: " << vob; Engine::GraphicsEngine->OnVobRemovedFromWorld(vob); @@ -1303,7 +1316,7 @@ void GothicAPI::OnRemovedVob(zCVob * vob, zCWorld * world) { } // delete light info, if valid - delete li; + if (li) delete li; } /** Called on a SetVisual-Call of a vob */ diff --git a/D3D11Engine/pch.h b/D3D11Engine/pch.h index 87a39e79..4eac3d26 100644 --- a/D3D11Engine/pch.h +++ b/D3D11Engine/pch.h @@ -28,7 +28,7 @@ #define stdext std #endif -#define VERSION_NUMBER "17.7-dev3" +#define VERSION_NUMBER "17.7-dev4" __declspec(selectany) const char* VERSION_NUMBER_STR = VERSION_NUMBER; extern bool GMPModeActive;