From c592037d29900b0033531d8f366ae3acbca9e202 Mon Sep 17 00:00:00 2001 From: Guillaume Pasero <guillaume.pasero@c-s.fr> Date: Fri, 16 Oct 2015 14:30:15 +0200 Subject: [PATCH] BUG: check if OTB_APPLICATION_PATH is empty --- .../src/otbWrapperApplicationRegistry.cxx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationRegistry.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationRegistry.cxx index ffc0f5c5b4..f98f9a3cbc 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationRegistry.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationRegistry.cxx @@ -159,8 +159,11 @@ ApplicationRegistry::CreateApplicationFaster(const std::string& name) #endif const char* otbAppPath = itksys::SystemTools::GetEnv("OTB_APPLICATION_PATH"); - - std::vector<itksys::String> pathList = itksys::SystemTools::SplitString(otbAppPath,pathSeparator,false); + std::vector<itksys::String> pathList; + if (otbAppPath) + { + pathList = itksys::SystemTools::SplitString(otbAppPath,pathSeparator,false); + } for (unsigned int i=0 ; i<pathList.size() ; ++i) { std::string possiblePath = pathList[i]; @@ -205,7 +208,11 @@ ApplicationRegistry::GetAvailableApplications(bool useFactory) #endif const char* otbAppPath = itksys::SystemTools::GetEnv("OTB_APPLICATION_PATH"); - std::vector<itksys::String> pathList = itksys::SystemTools::SplitString(otbAppPath,pathSeparator,false); + std::vector<itksys::String> pathList; + if (otbAppPath) + { + pathList = itksys::SystemTools::SplitString(otbAppPath,pathSeparator,false); + } for (unsigned int k=0 ; k<pathList.size() ; ++k) { itk::Directory::Pointer dir = itk::Directory::New(); -- GitLab