From 02ada74fa184076cdddc60b1d84a169d76b2a313 Mon Sep 17 00:00:00 2001 From: elsid Date: Wed, 8 Feb 2023 20:10:47 +0100 Subject: [PATCH] Do not try to dereference nullptr in object cache --- components/resource/objectcache.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/resource/objectcache.hpp b/components/resource/objectcache.hpp index 65b2606b06..6c155b9ec6 100644 --- a/components/resource/objectcache.hpp +++ b/components/resource/objectcache.hpp @@ -61,7 +61,8 @@ namespace Resource { // If ref count is greater than 1, the object has an external reference. // If the timestamp is yet to be initialized, it needs to be updated too. - if (itr->second.first->referenceCount() > 1 || itr->second.second == 0.0) + if ((itr->second.first != nullptr && itr->second.first->referenceCount() > 1) + || itr->second.second == 0.0) itr->second.second = referenceTime; } }