ui: Don't show stats snippet in code view when no project was loaded

This commit is contained in:
Eberhard Graether
2017-01-09 21:38:12 +01:00
parent cee8a52ca4
commit 95dd6dadfc
@@ -35,9 +35,14 @@ void CodeController::handleMessage(MessageActivateAll* message)
clear();
StorageStats stats = m_storageAccess->getStorageStats();
ErrorCountInfo errorCount = m_storageAccess->getErrorCount();
Project* currentProject = Application::getInstance()->getCurrentProject().get();
if (!currentProject)
{
return;
}
CodeSnippetParams statsSnippet;
statsSnippet.title = currentProject->getProjectSettingsFilePath().withoutExtension().fileName();
statsSnippet.startLineNumber = 1;
statsSnippet.endLineNumber = 1;
@@ -47,12 +52,6 @@ void CodeController::handleMessage(MessageActivateAll* message)
statsSnippet.locationFile = std::make_shared<TokenLocationFile>(FilePath());
statsSnippet.locationFile->isWholeCopy = true;
Project* currentProject = Application::getInstance()->getCurrentProject().get();
if (currentProject)
{
statsSnippet.title = currentProject->getProjectSettingsFilePath().withoutExtension().fileName();
}
std::vector<std::string> description = getProjectDescription(statsSnippet.locationFile.get());
std::stringstream ss;
@@ -66,6 +65,9 @@ void CodeController::handleMessage(MessageActivateAll* message)
}
}
StorageStats stats = m_storageAccess->getStorageStats();
ErrorCountInfo errorCount = m_storageAccess->getErrorCount();
ss << "\n";
ss << "\t" + std::to_string(stats.fileCount) + " files\n";
ss << "\t" + std::to_string(stats.fileLOCCount) + " lines of code\n";