Skip to content

Commit

Permalink
UB fix attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
strasdat committed Dec 18, 2024
1 parent 7efcd0a commit e2e23fe
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cpp/sophus/lie/pose3.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,11 @@ class Pose3 {

static Expected<Tangent> error(
Pose3 const& lhs_a_from_b, Pose3 const& rhs_a_from_b) {
return (lhs_a_from_b.inverse() * rhs_a_from_b)
.and_then([](Expected<Pose3> const& pose) -> Expected<Tangent> {
return pose->log();
});
Expected<Pose3> product = lhs_a_from_b.inverse() * rhs_a_from_b;
if (!product) {
return product.error();
}
return product->log();
}

friend Expected<Pose3> operator*(Pose3 const& lhs, Pose3 const& rhs) {
Expand Down

0 comments on commit e2e23fe

Please sign in to comment.