Avoid accessing an element of an empty vector in a log message

llvm-svn: 200784
This commit is contained in:
Ed Maste 2014-02-04 18:51:11 +00:00
parent a5da588b2f
commit aacfe09867
1 changed files with 12 additions and 10 deletions

View File

@ -313,18 +313,20 @@ Broadcaster::RestoreBroadcaster ()
{
Mutex::Locker event_types_locker(m_listeners_mutex);
Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_EVENTS));
if (log)
{
Listener *listener = m_hijacking_listeners.back();
log->Printf ("%p Broadcaster(\"%s\")::RestoreBroadcaster (about to pop listener(\"%s\")=%p)",
this,
m_broadcaster_name.AsCString(""),
listener->m_name.c_str(),
listener);
}
if (!m_hijacking_listeners.empty())
{
Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_EVENTS));
if (log)
{
Listener *listener = m_hijacking_listeners.back();
log->Printf ("%p Broadcaster(\"%s\")::RestoreBroadcaster (about to pop listener(\"%s\")=%p)",
this,
m_broadcaster_name.AsCString(""),
listener->m_name.c_str(),
listener);
}
m_hijacking_listeners.pop_back();
}
if (!m_hijacking_masks.empty())
m_hijacking_masks.pop_back();
}