File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed
nav2_costmap_2d/include/nav2_costmap_2d/denoise
nav2_mppi_controller/test Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ macro(nav2_package)
3737 endif ()
3838
3939 if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
40- add_compile_options (-Wall -Wextra -Wpedantic -Werror -Wdeprecated -fPIC -Wshadow)
40+ add_compile_options (-Wall -Wextra -Wpedantic -Werror -Wdeprecated -fPIC -Wshadow -Wnull-dereference )
4141 add_compile_options ("$<$<COMPILE_LANGUAGE:CXX>:-Wnon-virtual-dtor>" )
4242 endif ()
4343
Original file line number Diff line number Diff line change @@ -999,7 +999,10 @@ class GroupsRemover
999999 // The group of pixels labeled 0 corresponds to empty map cells.
10001000 // Zero bin of the histogram is equal to the number of pixels in this group.
10011001 // Because the values of empty map cells should not be changed, we will reset this bin
1002- groups_sizes.front () = 0 ; // don't change image background value
1002+ if (!groups_sizes.empty ()) {
1003+ groups_sizes.front () = 0 ; // don't change image background value
1004+ }
1005+
10031006
10041007 // noise_labels_table[i] = true if group with label i is noise
10051008 std::vector<bool > noise_labels_table (groups_sizes.size ());
Original file line number Diff line number Diff line change @@ -65,12 +65,22 @@ class CriticManagerWrapper : public CriticManager
6565
6666 bool getDummyCriticInitialized ()
6767 {
68- return dynamic_cast <DummyCritic *>(critics_[0 ].get ())->initialized_ ;
68+ const auto critic = critics_[0 ].get ();
69+ if (critic == nullptr ) {
70+ return false ;
71+ }
72+ const auto dummy_critic = dynamic_cast <DummyCritic *>(critic);
73+ return dummy_critic == nullptr ? false : dummy_critic->initialized_ ;
6974 }
7075
7176 bool getDummyCriticScored ()
7277 {
73- return dynamic_cast <DummyCritic *>(critics_[0 ].get ())->scored_ ;
78+ const auto critic = critics_[0 ].get ();
79+ if (critic == nullptr ) {
80+ return false ;
81+ }
82+ const auto dummy_critic = dynamic_cast <DummyCritic *>(critic);
83+ return dummy_critic == nullptr ? false : dummy_critic->scored_ ;
7484 }
7585};
7686
You can’t perform that action at this time.
0 commit comments