Skip to content

Commit

Permalink
fix: don't create new file from palette
Browse files Browse the repository at this point in the history
  • Loading branch information
Montel committed Oct 29, 2024
1 parent 6e781bc commit 018558f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ Document *Project::getDocument(QString fileName, bool moveToBack)
fileName = m_root + '/' + fileName;
else
fileName = fi.absoluteFilePath();
if (!QFileInfo::exists(fileName)) {
return {};
}

auto findIt = std::ranges::find_if(m_documents, [fileName](auto document) {
return document->fileName() == fileName;
Expand Down Expand Up @@ -329,6 +332,9 @@ Document *Project::open(const QString &fileName)
LOG(LOG_ARG("path", fileName));

m_current = getDocument(fileName, true);
if (!m_current) {
return {};
}
emit currentDocumentChanged(m_current);

LOG_RETURN("document", m_current);
Expand Down

0 comments on commit 018558f

Please sign in to comment.