Skip to content

Commit

Permalink
Fix potential crash on closing files when none are opened
Browse files Browse the repository at this point in the history
  • Loading branch information
Kingcom committed Jul 9, 2017
1 parent 8dec461 commit a86cd8e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Commands/CDirectiveFile.cpp
Expand Up @@ -51,8 +51,6 @@ void CDirectiveFile::initCopy(const std::wstring& inputName, const std::wstring&
void CDirectiveFile::initClose()
{
type = Type::Close;
closeFile = g_fileManager->getOpenFile();
g_fileManager->closeFile();
updateSection(++Global.Section);
}

Expand All @@ -69,6 +67,7 @@ bool CDirectiveFile::Validate()
g_fileManager->openFile(file,true);
return false;
case Type::Close:
closeFile = g_fileManager->getOpenFile();
g_fileManager->closeFile();
return false;
}
Expand Down Expand Up @@ -125,7 +124,8 @@ void CDirectiveFile::writeSymData(SymbolData& symData) const
file->beginSymData();
break;
case Type::Close:
closeFile->endSymData();
if (closeFile)
closeFile->endSymData();
break;
}
}
Expand Down

0 comments on commit a86cd8e

Please sign in to comment.