Fix crash in CheckResult cluster handlers

fixes #13151
This commit is contained in:
Michael Friedrich 2016-11-10 20:00:38 +01:00
parent 4b86f69c96
commit e7a6124924
1 changed files with 39 additions and 12 deletions

View File

@ -132,10 +132,16 @@ Value ClusterEvents::CheckResultAPIHandler(const MessageOrigin::Ptr& origin, con
if (params->Contains("cr")) { if (params->Contains("cr")) {
cr = new CheckResult(); cr = new CheckResult();
Dictionary::Ptr vcr = params->Get("cr"); Dictionary::Ptr vcr = params->Get("cr");
if (vcr && vcr->Contains("performance_data")) {
vperf = vcr->Get("performance_data"); vperf = vcr->Get("performance_data");
if (vperf)
vcr->Remove("performance_data"); vcr->Remove("performance_data");
Deserialize(cr, vcr, true); Deserialize(cr, vcr, true);
} }
}
if (!cr) if (!cr)
return Empty; return Empty;
@ -833,14 +839,21 @@ Value ClusterEvents::SendNotificationsAPIHandler(const MessageOrigin::Ptr& origi
} }
CheckResult::Ptr cr; CheckResult::Ptr cr;
Array::Ptr vperf;
if (params->Contains("cr")) { if (params->Contains("cr")) {
cr = new CheckResult(); cr = new CheckResult();
Dictionary::Ptr vcr = params->Get("cr"); Dictionary::Ptr vcr = params->Get("cr");
Array::Ptr vperf = vcr->Get("performance_data");
if (vcr && vcr->Contains("performance_data")) {
vperf = vcr->Get("performance_data");
if (vperf)
vcr->Remove("performance_data"); vcr->Remove("performance_data");
Deserialize(cr, vcr, true); Deserialize(cr, vcr, true);
} }
}
NotificationType type = static_cast<NotificationType>(static_cast<int>(params->Get("type"))); NotificationType type = static_cast<NotificationType>(static_cast<int>(params->Get("type")));
String author = params->Get("author"); String author = params->Get("author");
@ -919,14 +932,21 @@ Value ClusterEvents::NotificationSentUserAPIHandler(const MessageOrigin::Ptr& or
} }
CheckResult::Ptr cr; CheckResult::Ptr cr;
Array::Ptr vperf;
if (params->Contains("cr")) { if (params->Contains("cr")) {
cr = new CheckResult(); cr = new CheckResult();
Dictionary::Ptr vcr = params->Get("cr"); Dictionary::Ptr vcr = params->Get("cr");
Array::Ptr vperf = vcr->Get("performance_data");
if (vcr && vcr->Contains("performance_data")) {
vperf = vcr->Get("performance_data");
if (vperf)
vcr->Remove("performance_data"); vcr->Remove("performance_data");
Deserialize(cr, vcr, true); Deserialize(cr, vcr, true);
} }
}
NotificationType type = static_cast<NotificationType>(static_cast<int>(params->Get("type"))); NotificationType type = static_cast<NotificationType>(static_cast<int>(params->Get("type")));
String author = params->Get("author"); String author = params->Get("author");
@ -1027,14 +1047,21 @@ Value ClusterEvents::NotificationSentToAllUsersAPIHandler(const MessageOrigin::P
} }
CheckResult::Ptr cr; CheckResult::Ptr cr;
Array::Ptr vperf;
if (params->Contains("cr")) { if (params->Contains("cr")) {
cr = new CheckResult(); cr = new CheckResult();
Dictionary::Ptr vcr = params->Get("cr"); Dictionary::Ptr vcr = params->Get("cr");
Array::Ptr vperf = vcr->Get("performance_data");
if (vcr && vcr->Contains("performance_data")) {
vperf = vcr->Get("performance_data");
if (vperf)
vcr->Remove("performance_data"); vcr->Remove("performance_data");
Deserialize(cr, vcr, true); Deserialize(cr, vcr, true);
} }
}
NotificationType type = static_cast<NotificationType>(static_cast<int>(params->Get("type"))); NotificationType type = static_cast<NotificationType>(static_cast<int>(params->Get("type")));
String author = params->Get("author"); String author = params->Get("author");