Skip to content

Commit

Permalink
LogManager: Check if listener is valid before using it
Browse files Browse the repository at this point in the history
  • Loading branch information
leoetlino committed Jun 17, 2017
1 parent a2ad3e1 commit dd8dcdf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Source/Core/Common/Logging/LogManager.cpp
Expand Up @@ -164,7 +164,8 @@ void LogManager::LogWithFullPath(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE
LogTypes::LOG_LEVEL_TO_CHAR[(int)level], log->GetShortName().c_str(), temp);

for (auto listener_id : *log)
m_listeners[listener_id]->Log(level, msg.c_str());
if (m_listeners[listener_id])
m_listeners[listener_id]->Log(level, msg.c_str());
}

void LogManager::Init()
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Common/Logging/LogManager.h
Expand Up @@ -86,7 +86,7 @@ class LogManager : NonCopyable
private:
LogContainer* m_Log[LogTypes::NUMBER_OF_LOGS];
static LogManager* m_logManager; // Singleton. Ugh.
std::array<LogListener*, LogListener::NUMBER_OF_LISTENERS> m_listeners;
std::array<LogListener*, LogListener::NUMBER_OF_LISTENERS> m_listeners{};
size_t m_path_cutoff_point = 0;

LogManager();
Expand Down

0 comments on commit dd8dcdf

Please sign in to comment.