Skip to content

Commit 150abb6

Browse files
committed
metric_map save_to_file(): honor the return false instead of throw
1 parent b993e41 commit 150abb6

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

mp2p_icp_map/src/metricmap.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -644,11 +644,18 @@ bool metric_map_t::save_to_file(
644644
{
645645
return false;
646646
}
647+
try
648+
{
649+
auto arch = mrpt::serialization::archiveFrom(f);
650+
arch << *this;
647651

648-
auto arch = mrpt::serialization::archiveFrom(f);
649-
arch << *this;
650-
651-
return true;
652+
return true;
653+
}
654+
catch (const std::exception& e)
655+
{
656+
std::cerr << "[metric_map_t::save_to_file] Error: " << e.what();
657+
return false;
658+
}
652659
}
653660

654661
bool metric_map_t::load_from_file(

0 commit comments

Comments
 (0)