1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-11-15 14:25:00 +00:00

Fix defect detected by coverity scan (avoid null pointer dereference)

This commit is contained in:
Carles Fernandez 2018-08-30 20:04:36 +02:00
parent 1ea88104ac
commit aa3429ebb2
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D

View File

@ -328,17 +328,10 @@ arma::mat Euler_to_CTM(const arma::vec &eul)
double sin_psi = sin(eul(2)); double sin_psi = sin(eul(2));
double cos_psi = cos(eul(2)); double cos_psi = cos(eul(2));
arma::mat C = arma::zeros(3, 3);
// Calculate coordinate transformation matrix using (2.22) // Calculate coordinate transformation matrix using (2.22)
C(0, 0) = cos_theta * cos_psi; arma::mat C = {{cos_theta * cos_psi, cos_theta * sin_psi, -sin_theta},
C(0, 1) = cos_theta * sin_psi; {-cos_phi * sin_psi + sin_phi * sin_theta * cos_psi, cos_phi * cos_psi + sin_phi * sin_theta * sin_psi, sin_phi * cos_theta},
C(0, 2) = -sin_theta; {sin_phi * sin_psi + cos_phi * sin_theta * cos_psi, -sin_phi * cos_psi + cos_phi * sin_theta * sin_psi, cos_phi * cos_theta}};
C(1, 0) = -cos_phi * sin_psi + sin_phi * sin_theta * cos_psi;
C(1, 1) = cos_phi * cos_psi + sin_phi * sin_theta * sin_psi;
C(1, 2) = sin_phi * cos_theta;
C(2, 0) = sin_phi * sin_psi + cos_phi * sin_theta * cos_psi;
C(2, 1) = -sin_phi * cos_psi + cos_phi * sin_theta * sin_psi;
C(2, 2) = cos_phi * cos_theta;
return C; return C;
} }