From 215a0b17860885ca35a65ff4eda2af1142c0584b Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Mon, 11 Nov 2019 03:25:40 +0100 Subject: [PATCH] CID 273225 (#1 of 1): Using invalid iterator (INVALIDATE_ITERATOR) --- contrib/epee/include/syncobj.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/contrib/epee/include/syncobj.h b/contrib/epee/include/syncobj.h index a298b2dd..4f7e0903 100644 --- a/contrib/epee/include/syncobj.h +++ b/contrib/epee/include/syncobj.h @@ -526,9 +526,11 @@ namespace epee << prev_it->second.func_name << " @ " << prev_it->second.block_location << std::endl << " |" << std::endl << " V" << std::endl; prev_it = current_it; } - - ss << prev_it->second.thread_name << "(tid:" << prev_it->first << ") blocked by locker \"" << lock_name << "(owned by " << (*threads_chain.begin())->second.thread_name << " tid:" << (*threads_chain.begin())->first << ")] at " - << func_name << " @ " << location << std::endl; + if (prev_it != m_thread_owned_locks.end()) + { + ss << prev_it->second.thread_name << "(tid:" << prev_it->first << ") blocked by locker \"" << lock_name << "(owned by " << (*threads_chain.begin())->second.thread_name << " tid:" << (*threads_chain.begin())->first << ")] at " + << func_name << " @ " << location << std::endl; + } m_deadlock_journal.push_back(ss.str()); throw std::runtime_error(ss.str()); }