Skip to content

Commit 8a70713

Browse files
committed
Add more checks for null queue/net descriptors before usage
1 parent 3244a11 commit 8a70713

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

src/ReadoutApplication.cpp

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ ReadoutApplication::generate_modules(const confmodel::Session* session) const
121121
for (auto rule : get_queue_rules()) {
122122
auto destination_class = rule->get_destination_class();
123123
auto data_type = rule->get_descriptor()->get_data_type();
124-
// Why datahander here?
124+
// Why datahander here? It is the base class for several DataHandler types (e.g. FDDataHandlerModule, SNBDataHandlerModule)
125125
if (destination_class == "DataHandlerModule" || destination_class == dlh_class || destination_class == tph_class) {
126126
if (data_type == "DataRequest") {
127127
dlh_reqinput_qdesc = rule->get_descriptor();
@@ -135,6 +135,13 @@ ReadoutApplication::generate_modules(const confmodel::Session* session) const
135135
}
136136
}
137137

138+
if (dlh_input_qdesc == nullptr) {
139+
throw(BadConf(ERS_HERE, "No data link handler input queue descriptor given"));
140+
}
141+
if (dlh_reqinput_qdesc == nullptr) {
142+
throw(BadConf(ERS_HERE, "No data link handler request input queue descriptor given"));
143+
}
144+
138145
//
139146
// Process the network rules looking for the Fragment Aggregator and TP handler data reuest inputs
140147
//
@@ -157,6 +164,13 @@ ReadoutApplication::generate_modules(const confmodel::Session* session) const
157164
}
158165
}
159166

167+
if (fa_net_desc == nullptr) {
168+
throw(BadConf(ERS_HERE, "No Fragment Aggregator network descriptor given"));
169+
}
170+
if (ts_net_desc == nullptr && dlh_conf->get_generate_timesync()) {
171+
throw(BadConf(ERS_HERE, "No Time Sync network descriptor given but time sync generation is enabled"));
172+
}
173+
160174
// Create here the Queue on which all data fragments are forwarded to the fragment aggregator
161175
// and a container for the queues of data request to TP handler and DLH
162176
if (fa_output_qdesc == nullptr) {
@@ -281,7 +295,15 @@ ReadoutApplication::generate_modules(const confmodel::Session* session) const
281295
//
282296
std::vector<const confmodel::Connection*> tp_queues;
283297
if (get_tp_generation_enabled()) {
284-
298+
if (tp_input_qdesc == nullptr) {
299+
throw(BadConf(ERS_HERE, "TP generation is enabled but no TP input queue descriptor given"));
300+
}
301+
if (tp_net_desc == nullptr) {
302+
throw(BadConf(ERS_HERE, "TP generation is enabled but no TPSet network descriptor given"));
303+
}
304+
if (ta_net_desc == nullptr) {
305+
throw(BadConf(ERS_HERE, "TP generation is enabled but no TriggerActivity network descriptor given"));
306+
}
285307
// Create TP handler object
286308
auto tph_conf_obj = tph_conf->config_object();
287309
auto tpsrc_ids = get_tp_source_ids();

0 commit comments

Comments
 (0)