Fix crash on Mac OS X when parsing the command line parameters

This commit is contained in:
Sebastian Messmer 2016-02-13 20:59:51 +01:00
parent 53ef40ba46
commit e532885598

View File

@ -15,7 +15,9 @@ namespace cryfs {
vector<char*> afterDoubleDash; vector<char*> afterDoubleDash;
afterDoubleDash.reserve(options.size()-beforeDoubleDash.size()+1); afterDoubleDash.reserve(options.size()-beforeDoubleDash.size()+1);
afterDoubleDash.push_back(options[0]); afterDoubleDash.push_back(options[0]);
std::copy(doubleDashIterator+1, options.end(), std::back_inserter(afterDoubleDash)); if (options.end() >= doubleDashIterator+1) {
std::copy(doubleDashIterator + 1, options.end(), std::back_inserter(afterDoubleDash));
}
return make_pair( return make_pair(
beforeDoubleDash, beforeDoubleDash,
afterDoubleDash afterDoubleDash