check node data pointers in handleNodeIgnoreRequestPacket

This commit is contained in:
Stephen Birarda 2018-08-07 10:58:13 -07:00
parent 079b276c2b
commit c7ce8e5ce0

View file

@ -643,6 +643,7 @@ void AvatarMixer::handleNodeIgnoreRequestPacket(QSharedPointer<ReceivedMessage>
auto start = usecTimestampNow(); auto start = usecTimestampNow();
auto nodeList = DependencyManager::get<NodeList>(); auto nodeList = DependencyManager::get<NodeList>();
AvatarMixerClientData* nodeData = reinterpret_cast<AvatarMixerClientData*>(senderNode->getLinkedData()); AvatarMixerClientData* nodeData = reinterpret_cast<AvatarMixerClientData*>(senderNode->getLinkedData());
bool addToIgnore; bool addToIgnore;
message->readPrimitive(&addToIgnore); message->readPrimitive(&addToIgnore);
while (message->getBytesLeftToRead()) { while (message->getBytesLeftToRead()) {
@ -650,17 +651,22 @@ void AvatarMixer::handleNodeIgnoreRequestPacket(QSharedPointer<ReceivedMessage>
QUuid ignoredUUID = QUuid::fromRfc4122(message->readWithoutCopy(NUM_BYTES_RFC4122_UUID)); QUuid ignoredUUID = QUuid::fromRfc4122(message->readWithoutCopy(NUM_BYTES_RFC4122_UUID));
if (nodeList->nodeWithUUID(ignoredUUID)) { if (nodeList->nodeWithUUID(ignoredUUID)) {
// Reset the lastBroadcastTime for the ignored avatar to 0 if (nodeData) {
// so the AvatarMixer knows it'll have to send identity data about the ignored avatar // Reset the lastBroadcastTime for the ignored avatar to 0
// to the ignorer if the ignorer unignores. // so the AvatarMixer knows it'll have to send identity data about the ignored avatar
nodeData->setLastBroadcastTime(ignoredUUID, 0); // to the ignorer if the ignorer unignores.
nodeData->setLastBroadcastTime(ignoredUUID, 0);
}
// Reset the lastBroadcastTime for the ignorer (FROM THE PERSPECTIVE OF THE IGNORED) to 0 // Reset the lastBroadcastTime for the ignorer (FROM THE PERSPECTIVE OF THE IGNORED) to 0
// so the AvatarMixer knows it'll have to send identity data about the ignorer // so the AvatarMixer knows it'll have to send identity data about the ignorer
// to the ignored if the ignorer unignores. // to the ignored if the ignorer unignores.
auto ignoredNode = nodeList->nodeWithUUID(ignoredUUID); auto ignoredNode = nodeList->nodeWithUUID(ignoredUUID);
AvatarMixerClientData* ignoredNodeData = reinterpret_cast<AvatarMixerClientData*>(ignoredNode->getLinkedData()); AvatarMixerClientData* ignoredNodeData = reinterpret_cast<AvatarMixerClientData*>(ignoredNode->getLinkedData());
ignoredNodeData->setLastBroadcastTime(senderNode->getUUID(), 0); if (ignoredNodeData) {
ignoredNodeData->setLastBroadcastTime(senderNode->getUUID(), 0);
}
} }
if (addToIgnore) { if (addToIgnore) {