xdspacelab/openvslam

We should check if keyfrm is NULL in one of the loop in global optimize?

Dung-ND opened this issue · 0 comments

Hi
In this loop:

for (auto keyfrm : keyfrms) {
if (keyfrm->will_be_erased()) {
continue;
}
auto keyfrm_vtx = keyfrm_vtx_container.get_vertex(keyfrm);
const auto cam_pose_cw = util::converter::to_eigen_mat(keyfrm_vtx->estimate());
if (lead_keyfrm_id_in_global_BA == 0) {
keyfrm->set_cam_pose(cam_pose_cw);
}
else {
keyfrm->cam_pose_cw_after_loop_BA_ = cam_pose_cw;
keyfrm->loop_BA_identifier_ = lead_keyfrm_id_in_global_BA;
}
}

should we have if (!keyfrm) condition?