Skip to content
Snippets Groups Projects
Commit 0de6c01a authored by andy's avatar andy
Browse files

BUG: functionObjectFile - file pointer index was not being incremented

parent 5cc01e73
No related merge requests found
...@@ -97,6 +97,8 @@ void Foam::functionObjectFile::createFiles() ...@@ -97,6 +97,8 @@ void Foam::functionObjectFile::createFiles()
filePtrs_.set(i, new OFstream(outputDir/(fName + ".dat"))); filePtrs_.set(i, new OFstream(outputDir/(fName + ".dat")));
writeFileHeader(i); writeFileHeader(i);
i++;
} }
} }
} }
...@@ -240,6 +242,13 @@ Foam::OFstream& Foam::functionObjectFile::file() ...@@ -240,6 +242,13 @@ Foam::OFstream& Foam::functionObjectFile::file()
<< endl; << endl;
} }
if (!filePtrs_.set(0))
{
FatalErrorIn("Foam::OFstream& Foam::functionObjectFile::file()")
<< "File pointer at index " << 0 << " not allocated"
<< abort(FatalError);
}
return filePtrs_[0]; return filePtrs_[0];
} }
...@@ -269,6 +278,13 @@ Foam::OFstream& Foam::functionObjectFile::file(const label i) ...@@ -269,6 +278,13 @@ Foam::OFstream& Foam::functionObjectFile::file(const label i)
<< abort(FatalError); << abort(FatalError);
} }
if (!filePtrs_.set(i))
{
FatalErrorIn("Foam::OFstream& Foam::functionObjectFile::file()")
<< "File pointer at index " << i << " not allocated"
<< abort(FatalError);
}
return filePtrs_[i]; return filePtrs_[i];
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment