multi: fix SEGV for scan
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 30 Aug 2012 10:54:45 +0000 (12:54 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 30 Aug 2012 10:54:45 +0000 (12:54 +0200)
src/filter_multi.cpp

index ccdcc4a..b32c115 100644 (file)
@@ -1112,7 +1112,7 @@ void yf::Multi::Frontend::scan2(mp::Package &package, Z_APDU *apdu_req)
                                 entries_before.begin();
                             while (it != entries_before.end() && my <*it)
                                 it++;
-                            if (my == *it)
+                            if (it != entries_before.end() && my == *it)
                             {
                                 it->m_count += my.m_count;
                             }
@@ -1153,7 +1153,7 @@ void yf::Multi::Frontend::scan2(mp::Package &package, Z_APDU *apdu_req)
                                 entries_after.begin();
                             while (it != entries_after.end() && *it < my)
                                 it++;
-                            if (my == *it)
+                            if (it != entries_after.end() && my == *it)
                             {
                                 it->m_count += my.m_count;
                             }