1
0
Fork 0

fix a crash in the counter manager (#2665)

This commit is contained in:
Jan 2017-06-26 16:28:53 +02:00 committed by Frank Celler
parent e5819bf5ff
commit dd59eee715
1 changed files with 8 additions and 3 deletions

View File

@ -528,16 +528,21 @@ public:
} }
void storeLastKeyValue(uint64_t objectId, uint64_t keyValue) { void storeLastKeyValue(uint64_t objectId, uint64_t keyValue) {
if (keyValue == 0) {
return;
}
auto it = _generators->find(objectId); auto it = _generators->find(objectId);
if (it == _generators->end() && keyValue != 0) {
if (it == _generators->end()) {
try { try {
_generators->emplace(objectId, keyValue); _generators->emplace(objectId, keyValue);
} catch (...) {} } catch (...) {}
return; return;
} }
if (keyValue > it->second) { if (keyValue > (*it).second) {
it->second = keyValue; (*it).second = keyValue;
} }
} }