Clarify some iterator checks (where asserts were used before)

* Reported by Coverity Scan - mostly this is just adding error checking
  where there was previously just an assert before a use of an invalid
  iterator.
This commit is contained in:
baldurk
2017-11-22 19:11:23 +00:00
parent 74e25673d2
commit 725337df26
9 changed files with 247 additions and 184 deletions
+12 -6
View File
@@ -442,12 +442,18 @@ vector<CounterResult> VulkanReplay::FetchCounters(const vector<GPUCounter> &coun
// find the result we're aliasing
auto it = std::find(ret.begin(), ret.end(), search);
RDCASSERT(it != ret.end());
// duplicate the result and append
CounterResult aliased = *it;
aliased.eventID = cb.m_AliasEvents[i].second;
ret.push_back(aliased);
if(it != ret.end())
{
// duplicate the result and append
CounterResult aliased = *it;
aliased.eventID = cb.m_AliasEvents[i].second;
ret.push_back(aliased);
}
else
{
RDCERR("Expected to find alias-target result for EID %u counter %u, but didn't",
search.eventID, search.counterID);
}
}
}