From bb0a246d689d90d4dd01778879de6c2cbecb3e72 Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Sun, 30 Oct 2016 21:38:10 +0300 Subject: [PATCH] [vcs-log] if storage is broken, assertion is meaningless, top commit cache is broken as well EA-87308 --- .../src/com/intellij/vcs/log/data/TopCommitsCache.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/TopCommitsCache.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/TopCommitsCache.java index 967cfe90c8ce..90534a8ba0e6 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/TopCommitsCache.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/TopCommitsCache.java @@ -45,10 +45,14 @@ public class TopCommitsCache { Iterator it = new MergingIterator(mySortedDetails, newDetails); List result = ContainerUtil.newArrayList(); + boolean isBroken = false; while (it.hasNext()) { VcsCommitMetadata detail = it.next(); int index = getIndex(detail); - if (index == VcsLogStorageImpl.NO_INDEX) continue; // means some error happened (and reported) earlier, nothing we can do here + if (index == VcsLogStorageImpl.NO_INDEX) { + isBroken = true; + continue; // means some error happened (and reported) earlier, nothing we can do here + } if (result.size() < VcsLogData.RECENT_COMMITS_COUNT * 2) { result.add(detail); myCache.put(index, detail); @@ -57,7 +61,7 @@ public class TopCommitsCache { myCache.remove(index); } } - assert result.size() == myCache.size() : result.size() + " details to store, yet " + myCache.size() + " indexes in cache."; + assert result.size() == myCache.size() || isBroken : result.size() + " details to store, yet " + myCache.size() + " indexes in cache."; mySortedDetails = result; }