fix: crash when open a project that has files not opened in editor

This commit is contained in:
Roy Qu 2022-03-22 18:39:53 +08:00
parent 8fe0854f92
commit 0e0a87584e
1 changed files with 4 additions and 3 deletions

View File

@ -642,13 +642,14 @@ void Project::associateEditor(Editor *editor)
void Project::associateEditorToUnit(Editor *editor, PProjectUnit unit)
{
if (!unit)
if (!unit) {
if (editor)
editor->setInProject(false);
return;
}
if (editor) {
unit->setEncoding(editor->encodingOption());
editor->setInProject(true);
} else {
editor->setInProject(false);
}
}