Fix crash when loading a trace with unresolved strings.

Unresolved strings ("???") are not saved, but the internal string
pointers are saved. Resolving such string pointers caused a crash.
This commit is contained in:
Bartosz Taudul 2018-10-21 16:38:20 +02:00
parent 9342ba0e71
commit 793e955480

View File

@ -392,7 +392,11 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
{
uint64_t id, ptr;
f.Read2( id, ptr );
m_data.strings.emplace( id, pointerMap.find( ptr )->second );
auto it = pointerMap.find( ptr );
if( it != pointerMap.end() )
{
m_data.strings.emplace( id, it->second );
}
}
f.Read( sz );
@ -400,7 +404,11 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
{
uint64_t id, ptr;
f.Read2( id, ptr );
m_data.threadNames.emplace( id, pointerMap.find( ptr )->second );
auto it = pointerMap.find( ptr );
if( it != pointerMap.end() )
{
m_data.threadNames.emplace( id, it->second );
}
}
if( fileVer >= FileVersion( 0, 3, 201 ) )