Fix another RedisWriter crash

Same as the other fix, this makes us lose events
This commit is contained in:
Jean Flach 2018-11-16 15:42:36 +01:00 committed by Michael Friedrich
parent eec1928a0b
commit a056e14834
1 changed files with 4 additions and 2 deletions

View File

@ -703,13 +703,15 @@ void RedisWriter::VersionChangedHandler(const ConfigObject::Ptr& object)
if (object->IsActive()) {
// Create or update the object config
for (const RedisWriter::Ptr& rw : ConfigType::GetObjectsByType<RedisWriter>()) {
rw->m_WorkQueue.Enqueue(std::bind(&RedisWriter::SendConfigUpdate, rw, object, true));
if (rw)
rw->m_WorkQueue.Enqueue(std::bind(&RedisWriter::SendConfigUpdate, rw, object, true));
}
} else if (!object->IsActive() &&
object->GetExtension("ConfigObjectDeleted")) { // same as in apilistener-configsync.cpp
// Delete object config
for (const RedisWriter::Ptr& rw : ConfigType::GetObjectsByType<RedisWriter>()) {
rw->m_WorkQueue.Enqueue(std::bind(&RedisWriter::SendConfigDelete, rw, object));
if (rw)
rw->m_WorkQueue.Enqueue(std::bind(&RedisWriter::SendConfigDelete, rw, object));
}
}
}