Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit 22b2ebb

Browse files
authored
Fix issue with synapse reports (#470)
* synapse_id can be 0 and hence nrn_assert can fail * assert for the nullptr first and then dereference the pointer
1 parent 5168379 commit 22b2ebb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

coreneuron/io/reports/report_handler.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,10 @@ VarsToReport ReportHandler::get_custom_vars_to_report(const NrnThread& nt,
284284
if ((nodes_to_gids[ml->nodeindices[j]] == gid) && report_variable) {
285285
double* var_value =
286286
get_var_location_from_var_name(report.mech_id, report.var_name.data(), ml, j);
287-
const auto synapse_id = static_cast<int>(
288-
*get_var_location_from_var_name(report.mech_id, SYNAPSE_ID_MOD_NAME, ml, j));
287+
double* synapse_id =
288+
get_var_location_from_var_name(report.mech_id, SYNAPSE_ID_MOD_NAME, ml, j);
289289
nrn_assert(synapse_id && var_value);
290-
to_report.emplace_back(synapse_id, var_value);
290+
to_report.emplace_back(static_cast<int>(*synapse_id), var_value);
291291
}
292292
}
293293
if (!to_report.empty()) {

0 commit comments

Comments
 (0)