mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2555 Detect restart file reference looping. Break out if loop is detected
This commit is contained in:
parent
2cc93fb09d
commit
951e0f7aa0
@ -22,6 +22,8 @@
|
|||||||
#include "RifReaderEclipseOutput.h"
|
#include "RifReaderEclipseOutput.h"
|
||||||
#include "RifEclipseSummaryTools.h"
|
#include "RifEclipseSummaryTools.h"
|
||||||
|
|
||||||
|
#include "RiaLogging.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
@ -144,7 +146,17 @@ std::vector<RifRestartFileInfo> RifReaderEclipseSummary::getRestartFiles(const Q
|
|||||||
currFile.fileName = headerFileName;
|
currFile.fileName = headerFileName;
|
||||||
while(!currFile.fileName.isEmpty())
|
while(!currFile.fileName.isEmpty())
|
||||||
{
|
{
|
||||||
|
QString prevFile = currFile.fileName;
|
||||||
|
|
||||||
currFile = getRestartFile(currFile.fileName);
|
currFile = getRestartFile(currFile.fileName);
|
||||||
|
|
||||||
|
// Fix to stop potential infinite loop
|
||||||
|
if (currFile.fileName == prevFile)
|
||||||
|
{
|
||||||
|
RiaLogging::error("RifReaderEclipseSummary: Restart file reference loop detected");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!currFile.fileName.isEmpty())
|
if (!currFile.fileName.isEmpty())
|
||||||
restartFiles.push_back(currFile);
|
restartFiles.push_back(currFile);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user