Handle GetLatestResult segfault (#259)

* Handle GetLatestResult segfault

* Update PhotonCamera.cpp

* Update PhotonCamera.cpp
This commit is contained in:
Vasista Vovveti
2021-03-21 15:29:29 -05:00
committed by GitHub
parent e9a3c2d1b8
commit f9fd7a0b45

View File

@@ -45,7 +45,10 @@ PhotonPipelineResult PhotonCamera::GetLatestResult() const {
PhotonPipelineResult result;
// Fill the packet with latest data and populate result.
std::string value = rawBytesEntry.GetValue()->GetRaw();
std::shared_ptr<nt::Value> ntvalue = rawBytesEntry.GetValue();
if (!ntvalue) return result;
std::string value = ntvalue->GetRaw();
std::vector<char> bytes{value.begin(), value.end()};
photonlib::Packet packet{bytes};