bugfix: only push the blob id if new
Only push the blob id for the opened blob if this is the first time it's
been opened.
Tested: Verified it no longer just keeps growing the list every time one
opens.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I1b42ce769c3c1279bdc1f7e99e8ab74c67c1427a
diff --git a/firmware_handler.cpp b/firmware_handler.cpp
index f074bce..af61730 100644
--- a/firmware_handler.cpp
+++ b/firmware_handler.cpp
@@ -411,7 +411,16 @@
lookup[session] = curr;
- blobIDs.push_back(*active);
+ /* This may be them re-opening a blob, so let's only push it onto the list
+ * when appropriate.
+ */
+ auto blobIdMatch =
+ std::find_if(blobIDs.begin(), blobIDs.end(),
+ [active](const auto& iter) { return (iter == *active); });
+ if (blobIdMatch == blobIDs.end())
+ {
+ blobIDs.push_back(*active);
+ }
fileOpen = true;