Skip to content

Commit eaafacf

Browse files
authored
protection against empty reasons in beautify function (#1748)
* protection against empty reasons in beautify function * too much info from the checker * now info is fixed
1 parent 21d1f09 commit eaafacf

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

Modules/FIT/FV0/src/TriggersSwVsTcmCheck.cxx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ std::string TriggersSwVsTcmCheck::getAcceptedType() { return "TH2"; }
106106

107107
void TriggersSwVsTcmCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult)
108108
{
109+
if (!mo) {
110+
ILOG(Error, Support) << "beautify(): MO NULL pointer" << ENDM;
111+
return;
112+
}
113+
109114
if (mo->getName() == "TriggersSoftwareVsTCM") {
110115
auto* histogram = dynamic_cast<TH2*>(mo->getObject());
111116

@@ -118,7 +123,13 @@ void TriggersSwVsTcmCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality c
118123
histogram->GetListOfFunctions()->Add(msg);
119124
msg->SetName(Form("%s_msg", mo->GetName()));
120125
msg->Clear();
121-
msg->AddText(checkResult.getReasons()[0].second.c_str());
126+
auto reasons = checkResult.getReasons();
127+
for (int i = 0; i < int(reasons.size()); i++) {
128+
if (i == 0) {
129+
msg->AddText(reasons[i].second.c_str());
130+
break;
131+
}
132+
}
122133
int color = kBlack;
123134
if (checkResult == Quality::Good) {
124135
color = kGreen + 1;

0 commit comments

Comments
 (0)