Fix crash in ClusterListener::ReplayLog().

This commit is contained in:
Gunnar Beutner 2013-10-11 08:19:58 +02:00
parent 834f9cd110
commit b204061d9f

View File

@ -443,9 +443,13 @@ void ClusterListener::ReplayLog(const Endpoint::Ptr& endpoint, const Stream::Ptr
String message; String message;
while (true) { while (true) {
Dictionary::Ptr pmessage;
try { try {
if (!NetString::ReadStringFromStream(lstream, &message)) if (!NetString::ReadStringFromStream(lstream, &message))
break; break;
pmessage = Value::Deserialize(message);
} catch (std::exception&) { } catch (std::exception&) {
Log(LogWarning, "cluster", "Unexpected end-of-file for cluster log: " + path); Log(LogWarning, "cluster", "Unexpected end-of-file for cluster log: " + path);
@ -453,8 +457,6 @@ void ClusterListener::ReplayLog(const Endpoint::Ptr& endpoint, const Stream::Ptr
break; break;
} }
Dictionary::Ptr pmessage = Value::Deserialize(message);
if (pmessage->Get("timestamp") < peer_ts) if (pmessage->Get("timestamp") < peer_ts)
continue; continue;