From 5561d40e67653912bb420b8c9ac60cd78b351edd Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 12 Jul 2019 19:09:26 +0200 Subject: [PATCH] Fix defect detected by Coverity Scan (null pointer dereference) --- src/algorithms/libs/geofunctions.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/algorithms/libs/geofunctions.cc b/src/algorithms/libs/geofunctions.cc index 8670b9504..6da551c80 100644 --- a/src/algorithms/libs/geofunctions.cc +++ b/src/algorithms/libs/geofunctions.cc @@ -302,7 +302,9 @@ double mstokph(double MetersPerSeconds) arma::vec CTM_to_Euler(const arma::mat &C) { // Calculate Euler angles using (2.23) - arma::mat CTM(C); + arma::mat CTM = {{C(0, 0), C(0, 1), C(0, 2)}, + {C(1, 0), C(1, 1), C(1, 2)}, + {C(2, 0), C(2, 1), C(2, 2)}}; arma::vec eul = arma::zeros(3, 1); eul(0) = atan2(CTM(1, 2), CTM(2, 2)); // roll if (CTM(0, 2) < -1.0)