mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 12:04:18 +02:00
Crash fix for AvatarManager when iterating over _avatarHash
The main problem is that a null shared pointer was inserted into the _avatarHash via the AvatarManager::getAvatarBySessionID(). When the sessionID is not present in the _avatarHash, [QHash](http://doc.qt.io/qt-5/qhash.html#operator-5b-5d) will *insert* an empty smart_ptr into the hash.
This commit is contained in:
parent
710b51fe14
commit
085282db4f
1 changed files with 6 additions and 1 deletions
|
@ -366,5 +366,10 @@ AvatarSharedPointer AvatarManager::getAvatarBySessionID(const QUuid& sessionID)
|
|||
return std::static_pointer_cast<Avatar>(_myAvatar);
|
||||
}
|
||||
QReadLocker locker(&_hashLock);
|
||||
return _avatarHash[sessionID];
|
||||
auto iter = _avatarHash.find(sessionID);
|
||||
if (iter != _avatarHash.end()) {
|
||||
return iter.value();
|
||||
} else {
|
||||
return AvatarSharedPointer();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue