From 7f70d98bb43e8a0167a0d32803756b3e02f242da Mon Sep 17 00:00:00 2001 From: zvon Date: Tue, 29 Sep 2020 18:33:50 +0200 Subject: [PATCH] Maybe fix possible race condition --- sdlpp.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdlpp.hpp b/sdlpp.hpp index a17596d..8b196b5 100644 --- a/sdlpp.hpp +++ b/sdlpp.hpp @@ -533,7 +533,8 @@ public: std::vector< std::shared_ptr< RenderObject > > getObjects(const std::unordered_set< int > &objectIDs) { std::vector< std::shared_ptr< RenderObject > > ret{}; for ( const auto &x : render_objects ) { - if ( objectIDs.find( x->getId() ) != objectIDs.end() ) { + // check if object exists because of possible race condition + if ( x && objectIDs.find( x->getId() ) != objectIDs.end() ) { ret.push_back( x ); } }