Skip to content

Commit aba6985

Browse files
committed
Add null check for casting to TH1 or TH2
1 parent 898f869 commit aba6985

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Fitters/PredictiveThrower.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,11 @@ std::vector<std::vector<std::unique_ptr<TH2D>>> PredictiveThrower::ProduceSpectr
497497
throw MaCh3Exception(__FILE__, __LINE__);
498498
}
499499

500+
if (!refHist) {
501+
MACH3LOG_ERROR("Failed to cast to {} dimensions in {}!", nDims, __func__);
502+
throw MaCh3Exception(__FILE__, __LINE__);
503+
}
504+
500505
const int n_bins_x = refHist->GetNbinsX();
501506
std::vector<double> x_bin_edges(n_bins_x + 1);
502507
for (int b = 0; b <= n_bins_x; ++b) {

0 commit comments

Comments
 (0)