diff --git a/lib/Utilities/src/Logging.cpp b/lib/Utilities/src/Logging.cpp index 7e38d068..27ad9ff1 100644 --- a/lib/Utilities/src/Logging.cpp +++ b/lib/Utilities/src/Logging.cpp @@ -114,14 +114,17 @@ bool Logging::selectSink(const String& name) while ((MAX_SINKS > index) && (false == status)) { - if (m_sinks[index]->getName() == name) + if (nullptr != m_sinks[index]) { - m_selectedSink = m_sinks[index]; - status = true; - } - else - { - ++index; + if (m_sinks[index]->getName() == name) + { + m_selectedSink = m_sinks[index]; + status = true; + } + else + { + ++index; + } } } diff --git a/lib/Utilities/src/Logging.h b/lib/Utilities/src/Logging.h index a7bfcb1e..f42694fc 100644 --- a/lib/Utilities/src/Logging.h +++ b/lib/Utilities/src/Logging.h @@ -359,14 +359,8 @@ class Logging /** * Construct Logging. */ - Logging() : m_currentLogLevel(LOG_LEVEL_INFO), m_sinks(), m_selectedSink(nullptr) + Logging() : m_currentLogLevel(LOG_LEVEL_INFO), m_sinks{nullptr}, m_selectedSink(nullptr) { - uint8_t index = 0U; - - for (index = 0U; index < MAX_SINKS; ++index) - { - m_sinks[index] = nullptr; - } } /**