diff --git a/lib/redis/rediswriter-objects.cpp b/lib/redis/rediswriter-objects.cpp index 8b0e972d4..3673973ff 100644 --- a/lib/redis/rediswriter-objects.cpp +++ b/lib/redis/rediswriter-objects.cpp @@ -153,7 +153,7 @@ static ConfigObject::Ptr GetObjectByName(const String& name) // Used to update a single object, used for runtime updates void RedisWriter::SendConfigUpdate(const ConfigObject::Ptr& object, bool runtimeUpdate) { - if (!m_Rcon->IsConnected()) + if (!m_Rcon || !m_Rcon->IsConnected()) return; String typeName = GetLowerCaseTypeNameDB(object); diff --git a/lib/redis/rediswriter.cpp b/lib/redis/rediswriter.cpp index b9843da45..41fe0d048 100644 --- a/lib/redis/rediswriter.cpp +++ b/lib/redis/rediswriter.cpp @@ -111,7 +111,7 @@ void RedisWriter::TryToReconnect() else m_Rcon->Start(); - if (!m_Rcon->IsConnected()) + if (!m_Rcon || !m_Rcon->IsConnected()) return; UpdateSubscriptions(); @@ -145,7 +145,7 @@ void RedisWriter::UpdateSubscriptions() * But since we expect and answer here and break Icinga in case of receiving no answer/an unexpected one we opt for * better safe than sorry here. Future implementation needs to include an improved error handling and answer verification. */ - if (!m_Rcon->IsConnected()) + if (!m_Rcon || !m_Rcon->IsConnected()) return; long long cursor = 0; @@ -220,7 +220,7 @@ void RedisWriter::PublishStats() { AssertOnWorkQueue(); - if (!m_Rcon->IsConnected()) + if (!m_Rcon || !m_Rcon->IsConnected()) return; Dictionary::Ptr status = GetStats(); @@ -303,7 +303,7 @@ void RedisWriter::SendEvent(const Dictionary::Ptr& event) { AssertOnWorkQueue(); - if (!m_Rcon->IsConnected()) + if (!m_Rcon || !m_Rcon->IsConnected()) return; String type = event->Get("type");