entitylump: Fix behavior of append (#1836)
This change ensures that the iterator values used by `std::distance` is correct. Having the emplace within leads to the possibility of `m_Entities.begin()` being invalidated due to reallocations.
This commit is contained in:
		
							parent
							
								
									568da23c96
								
							
						
					
					
						commit
						855ece1d3b
					
				| @ -122,10 +122,8 @@ void EntityLumpManager::Insert(size_t index) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| size_t EntityLumpManager::Append() { | size_t EntityLumpManager::Append() { | ||||||
| 	return std::distance( | 	auto it = m_Entities.emplace(m_Entities.end(), std::make_shared<EntityLumpEntry>()); | ||||||
| 			m_Entities.begin(), | 	return std::distance(m_Entities.begin(), it); | ||||||
| 			m_Entities.emplace(m_Entities.end(), std::make_shared<EntityLumpEntry>()) |  | ||||||
| 	); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| size_t EntityLumpManager::Length() { | size_t EntityLumpManager::Length() { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user