Addresses an unsigned underflow situation that can occur when dumping an empty command history.

One example where this occurs in practice is starting the Swift REPL and typing ":command history" since REPL commands aren't stored in the LLDB command prompt history.

llvm-svn: 256888
This commit is contained in:
Kate Stone 2016-01-06 00:33:07 +00:00
parent 03f483353c
commit 0167e064f3
1 changed files with 2 additions and 2 deletions

View File

@ -130,9 +130,9 @@ CommandHistory::Dump (Stream& stream,
size_t stop_idx) const
{
Mutex::Locker locker(m_mutex);
stop_idx = std::min(stop_idx, m_history.size() - 1);
stop_idx = std::min(stop_idx + 1, m_history.size());
for (size_t counter = start_idx;
counter <= stop_idx;
counter < stop_idx;
counter++)
{
const std::string hist_item = m_history[counter];