Remove unused code and change error handling in marcel/get-name. (#8166)
* Minor cleanup: Remove unused code and change error handling. * Remove unlikely attribute.
This commit is contained in:
parent
73a716e24d
commit
b143ef1a31
|
@ -328,7 +328,6 @@ static carla::Buffer FWorldObserver_Serialize(
|
|||
carla::geom::Vector3D Acceleration(0.0f, 0.0f, 0.0f);
|
||||
carla::sensor::data::ActorDynamicState::TypeDependentState State{};
|
||||
|
||||
|
||||
check(View);
|
||||
|
||||
if(View->IsDormant())
|
||||
|
@ -353,9 +352,6 @@ static carla::Buffer FWorldObserver_Serialize(
|
|||
}
|
||||
ActorTransform = View->GetActorGlobalTransform();
|
||||
|
||||
auto ActorPtr = View->GetActor();
|
||||
check(ActorPtr != nullptr);
|
||||
|
||||
ActorDynamicState info = {
|
||||
View->GetActorId(),
|
||||
View->GetActorState(),
|
||||
|
|
|
@ -2655,10 +2655,14 @@ BIND_SYNC(is_sensor_enabled_for_ros) << [this](carla::streaming::detail::stream_
|
|||
{
|
||||
REQUIRE_CARLA_EPISODE();
|
||||
auto CarlaActor = Episode->FindCarlaActor(ActorID);
|
||||
check(CarlaActor != nullptr);
|
||||
if (CarlaActor == nullptr)
|
||||
return std::string();
|
||||
auto Actor = CarlaActor->GetActor();
|
||||
check(Actor != nullptr);
|
||||
if (Actor == nullptr)
|
||||
return std::string();
|
||||
auto Name = Actor->GetName();
|
||||
if (Name.Len() == 0)
|
||||
return std::string();
|
||||
auto NameStr = StringCast<UTF8CHAR>(*Name, Name.Len());
|
||||
return std::string((const char*)NameStr.Get(), NameStr.Length());
|
||||
};
|
||||
|
@ -2668,12 +2672,17 @@ BIND_SYNC(is_sensor_enabled_for_ros) << [this](carla::streaming::detail::stream_
|
|||
{
|
||||
REQUIRE_CARLA_EPISODE();
|
||||
auto CarlaActor = Episode->FindCarlaActor(ActorID);
|
||||
check(CarlaActor != nullptr);
|
||||
if (CarlaActor == nullptr)
|
||||
return std::string();
|
||||
auto Actor = CarlaActor->GetActor();
|
||||
check(Actor != nullptr);
|
||||
if (Actor == nullptr)
|
||||
return std::string();
|
||||
auto Class = Actor->GetClass();
|
||||
check(Class != nullptr);
|
||||
if (Class == nullptr)
|
||||
return std::string();
|
||||
auto Name = Class->GetName();
|
||||
if (Name.Len() == 0)
|
||||
return std::string();
|
||||
auto NameStr = StringCast<UTF8CHAR>(*Name, Name.Len());
|
||||
return std::string((const char*)NameStr.Get(), NameStr.Length());
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue