diff --git a/wrappers/cpp/tools.cc b/wrappers/cpp/tools.cc index 9f7cdc9a7..1ebe600cb 100644 --- a/wrappers/cpp/tools.cc +++ b/wrappers/cpp/tools.cc @@ -73,8 +73,8 @@ const char *StringUtilities::cppStringToC(const std::string &cppstr) { std::list StringUtilities::cStringArrayToCppList(const char **cArray) { list cppList; - int i; - for(i=0; cArray[i]!=NULL; i++) { + if (cArray == NULL) return cppList; + for(int i=0; cArray[i]!=NULL; i++) { cppList.push_back(cArray[i]); } return cppList;