Skip to content

Commit 2275eab

Browse files
committed
check length of display-config parameter before extracting substring
1 parent 16933c2 commit 2275eab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/rviz/visualizer_app.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ bool VisualizerApp::init( int argc, char** argv )
172172
if (vm.count("display-config"))
173173
{
174174
display_config = vm["display-config"].as<std::string>();
175-
if( display_config.substr( display_config.size() - 4, 4 ) == ".vcg" )
175+
if (display_config.size() >= 4 && display_config.substr( display_config.size() - 4, 4 ) == ".vcg")
176176
{
177177
std::cerr << "ERROR: the config file '" << display_config << "' is a .vcg file, which is the old rviz config format." << std::endl;
178178
std::cerr << " New config files have a .rviz extension and use YAML formatting. The format changed" << std::endl;

0 commit comments

Comments
 (0)