Skip to content

Commit 7af7d16

Browse files
MessageStore: iterate over the list for removal only if it is not empty (#1358)
* MessageStore: iterate over the list for removal only if it is not empty * Update FileSystem.cpp --------- Co-authored-by: Pierre Wielders <[email protected]>
1 parent 68f4edc commit 7af7d16

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Source/core/MessageStore.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,14 @@ namespace WPEFramework {
5959

6060
_adminLock.Lock();
6161

62-
ASSERT(std::find(_controlList.begin(), _controlList.end(), control) != _controlList.end());
62+
if (_controlList.size() > 0) {
63+
ASSERT(std::find(_controlList.begin(), _controlList.end(), control) != _controlList.end());
6364

64-
auto entry = std::find(_controlList.begin(), _controlList.end(), control);
65-
if (entry != _controlList.end()) {
66-
_controlList.erase(entry);
65+
auto entry = std::find(_controlList.begin(), _controlList.end(), control);
66+
if (entry != _controlList.end()) {
67+
_controlList.erase(entry);
68+
}
6769
}
68-
6970
_adminLock.Unlock();
7071
}
7172

0 commit comments

Comments
 (0)