Skip to content

Commit 36370d0

Browse files
committed
[HF] Prevent a crash when an empty measurement is created.
The following code provided by Tomas Dado lead to a crash: RooStats::HistFactory::Measurement meas("meas", "meas"); meas.SetOutputFilePrefix("test"); meas.SetPOI("pt0_m0_y0_XSec"); meas.CollectHistograms(); std::unique_ptr<RooWorkspace> work(RooStats::HistFactory::MakeModelAndMeasurementFast(meas)); This is caused by a nullptr being passed to a HistFactory function. By returning early, the crash is avoided, and the following error message is produced: Error in <RooStats::HistFactory::HistoToWorkspaceFactoryFast::MakeCombinedModel>: Input vectors are empty - return a nullptr
1 parent 470df9e commit 36370d0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

roofit/histfactory/src/MakeModelAndMeasurementsFast.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ RooStats::HistFactory::MakeModelAndMeasurementFast(RooStats::HistFactory::Measur
190190

191191
// Use HistFactory to combine the individual channel workspaces
192192
std::unique_ptr<RooWorkspace> ws{factory.MakeCombinedModel(channel_names, channel_workspaces)};
193+
if (!ws) {
194+
return nullptr;
195+
}
193196

194197
// Configure that workspace
195198
HistoToWorkspaceFactoryFast::ConfigureWorkspaceForMeasurement("simPdf", ws.get(), measurement);

0 commit comments

Comments
 (0)