Maybe fix possible race condition

This commit is contained in:
zvon 2020-09-29 18:33:50 +02:00
parent 7621dc8dd4
commit 7f70d98bb4

View File

@ -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 );
}
}