fixed CarParams write in replay (#24613)

* fixed CarParams write in replay

* need to capture temporary object

Co-authored-by: Shane Smiskol <shane@smiskol.com>
old-commit-hash: dc1a7bf082bd38a0f0c6ca9a708ac10562048357
This commit is contained in:
Jake Lynn
2022-05-22 07:30:13 -04:00
committed by GitHub
parent 861bbaa62a
commit 7933015668
+4 -1
View File
@@ -275,7 +275,10 @@ void Replay::startStream(const Segment *cur_segment) {
it = std::find_if(events.begin(), events.end(), [](auto e) { return e->which == cereal::Event::Which::CAR_PARAMS; });
if (it != events.end()) {
car_fingerprint_ = (*it)->event.getCarParams().getCarFingerprint();
auto bytes = (*it)->bytes();
capnp::MallocMessageBuilder builder;
builder.setRoot((*it)->event.getCarParams());
auto words = capnp::messageToFlatArray(builder);
auto bytes = words.asBytes();
Params().put("CarParams", (const char *)bytes.begin(), bytes.size());
} else {
rWarning("failed to read CarParams from current segment");