src: fixed crash in scope title retrieval

This commit is contained in:
Eberhard Graether
2015-05-24 15:37:57 +02:00
parent 3eac920f8d
commit d985009bff
@@ -229,12 +229,16 @@ std::vector<CodeView::CodeSnippetParams> CodeController::getSnippetsForFile(std:
{
firstUsedLine = tempFile->findTokenLocationLineByNumber(i);
}
m_storageAccess->getTokenLocationOfParentScope(firstUsedLine->getTokenLocations().begin()->second.get())->forEachStartTokenLocation(
[&](TokenLocation* location)
{
params.title = m_storageAccess->getNameForNodeWithId(location->getTokenId());
}
);
if (firstUsedLine && firstUsedLine->getTokenLocations().size())
{
m_storageAccess->getTokenLocationOfParentScope(firstUsedLine->getTokenLocations().begin()->second.get())->forEachStartTokenLocation(
[&](TokenLocation* location)
{
params.title = m_storageAccess->getNameForNodeWithId(location->getTokenId());
}
);
}
for (const std::string& line: textAccess->getLines(params.startLineNumber, params.endLineNumber))
{