Fix segmentation fault if file name is missing after arraylist command.
This commit is contained in:
parent
af4b985eb2
commit
796a6416ca
@ -31,8 +31,9 @@ using EclEntry = Opm::EclIO::EclFile::EclEntry;
|
|||||||
|
|
||||||
static void printHelp() {
|
static void printHelp() {
|
||||||
|
|
||||||
std::cout << "\nList all arrays found in an EclFile specified on the command line. \n\n"
|
std::cout << "Usage: arraylist [OPTIONS] ECL_FILE_NAME"<<std::endl
|
||||||
<< "\nThe program have one option which will only work on unified restart files:\n\n"
|
<< "\nList all arrays found in an EclFile specified on the command line. \n\n"
|
||||||
|
<< "\nThe program has one option which will only work on unified restart files:\n\n"
|
||||||
<< "-h Print help and exit.\n"
|
<< "-h Print help and exit.\n"
|
||||||
<< "-r List array for a specific report time step number. Option only valid for a unified restart file. \n\n";
|
<< "-r List array for a specific report time step number. Option only valid for a unified restart file. \n\n";
|
||||||
}
|
}
|
||||||
@ -110,6 +111,14 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
int argOffset = optind;
|
int argOffset = optind;
|
||||||
|
|
||||||
|
if(argOffset >= argc)
|
||||||
|
{
|
||||||
|
std::cerr<<"Eclipse file name is missing. Please provide it "
|
||||||
|
<<"as the last argument."<<std::endl<<std::endl;
|
||||||
|
printHelp();
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
std::filesystem::path filename(argv[argOffset]);
|
std::filesystem::path filename(argv[argOffset]);
|
||||||
|
|
||||||
std::string ext = filename.extension().string();
|
std::string ext = filename.extension().string();
|
||||||
|
Loading…
Reference in New Issue
Block a user