From: Milian Wolff Date: Thu, 24 Mar 2016 21:34:08 +0000 (+0100) Subject: Make code more error resilient when parsing data files. X-Git-Tag: submit/tizen/20180620.112952^2~197 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=14d2e1ca7cb16b01a5620fc0ecc3acb144aa5cbe;p=sdk%2Ftools%2Fheaptrack.git Make code more error resilient when parsing data files. --- diff --git a/accumulatedtracedata.cpp b/accumulatedtracedata.cpp index 485d704..c0f455a 100644 --- a/accumulatedtracedata.cpp +++ b/accumulatedtracedata.cpp @@ -365,8 +365,11 @@ Allocation& AccumulatedTraceData::findAllocation(const TraceIndex traceIndex) [] (const Allocation& allocation, const TraceIndex traceIndex) -> bool { return allocation.traceIndex < traceIndex; }); - assert(it != allocations.end()); - assert(it->traceIndex == traceIndex); + if (it == allocations.end() || it->traceIndex != traceIndex) { + Allocation allocation; + allocation.traceIndex = traceIndex; + it = allocations.insert(it, allocation); + } return *it; } else if (traceIndex == m_maxAllocationTraceIndex && !allocations.empty()) { // reuse the last allocation