Fixed crash in LogPrivider 35/64235/4
authorIryna Ferenchak <i.ferenchak@samsung.com>
Thu, 31 Mar 2016 10:43:24 +0000 (13:43 +0300)
committerIryna Ferenchak <i.ferenchak@samsung.com>
Fri, 1 Apr 2016 07:34:39 +0000 (10:34 +0300)
Change-Id: Ife1a104992b7342d35b80cf672c57f2c94f54188
Signed-off-by: Iryna Ferenchak <i.ferenchak@samsung.com>
lib-logs/src/Logs/Model/LogProvider.cpp

index b5928a9..033f2da 100644 (file)
@@ -93,7 +93,12 @@ size_t LogProvider::fillGroupList(LogIterator begin, LogIterator end)
 {
        LogGroup *lastLogGroup = nullptr;
        if (!m_Groups.empty()) {
-               lastLogGroup = m_Groups.back().get();
+               for (auto groupIt = m_Groups.rbegin(); groupIt != m_Groups.rend(); ++groupIt) {
+                       if (!(*groupIt)->getLogList().empty()) {
+                               lastLogGroup = groupIt->get();
+                               break;
+                       }
+               }
        }
        size_t newGroupsCount = 0;