From 66564a4202cad2ad38c4a77344cd2d1052969338 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 14 Jul 2023 12:37:23 -0700 Subject: [PATCH] fine inside --- can/packer.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/can/packer.cc b/can/packer.cc index e5b6f4020b..9d03c2cad9 100644 --- a/can/packer.cc +++ b/can/packer.cc @@ -59,11 +59,13 @@ std::vector CANPacker::pack(uint32_t address, const std::vectorsecond.sigs) { - if (dbc_signal.offset != 0 && enforce_checks) { - auto sig_it = std::find_if(values.begin(), values.end(), [&dbc_signal](const SignalPackValue& spv) { return spv.name == dbc_signal.name; }); - if (sig_it == values.end()) { - throw std::runtime_error("CANPacker::pack(): missing signal with non-zero offset: " + dbc_signal.name + " in address " + std::to_string(address)); + if (enforce_checks) { + for (const auto& dbc_signal : msg_it->second.sigs) { + if (dbc_signal.offset != 0) { + auto sig_it = std::find_if(values.begin(), values.end(), [&dbc_signal](const SignalPackValue& spv) { return spv.name == dbc_signal.name; }); + if (sig_it == values.end()) { + throw std::runtime_error("CANPacker::pack(): missing signal with non-zero offset: " + dbc_signal.name + " in address " + std::to_string(address)); + } } } }