diff --git a/PhysicsTools/NanoAOD/plugins/TableOutputBranches.h b/PhysicsTools/NanoAOD/plugins/TableOutputBranches.h index f5619e27a3b6c..f408e65759e38 100644 --- a/PhysicsTools/NanoAOD/plugins/TableOutputBranches.h +++ b/PhysicsTools/NanoAOD/plugins/TableOutputBranches.h @@ -54,7 +54,9 @@ class TableOutputBranches { int idx = tab.columnIndex(pair.name); if (idx == -1) throw cms::Exception("LogicError", "Missing column in input for " + m_baseName + "_" + pair.name); - pair.branch->SetAddress(const_cast(&tab.columnData(idx).front())); // SetAddress should take a const * ! + pair.branch->SetAddress( + tab.size() == 0 ? static_cast(nullptr) + : const_cast(&tab.columnData(idx).front())); // SetAddress should take a const * ! } };