diff --git a/src/plugins/cpptools/insertionpointlocator.cpp b/src/plugins/cpptools/insertionpointlocator.cpp index 1d6a894f67cfd9ccdf8192874742b3cf784f10a8..fbf2bb3c6ad7093ce4321a397d07d2f83d381767 100644 --- a/src/plugins/cpptools/insertionpointlocator.cpp +++ b/src/plugins/cpptools/insertionpointlocator.cpp @@ -328,7 +328,9 @@ QList<InsertionLocation> InsertionPointLocator::methodDefinition( QString target = declFileName; if (!isSourceFile(declFileName)) { Internal::CppToolsPlugin *cpptools = Internal::CppToolsPlugin::instance(); - target = cpptools->correspondingHeaderOrSource(declFileName); + QString candidate = cpptools->correspondingHeaderOrSource(declFileName); + if (!candidate.isEmpty()) + target = candidate; } Document::Ptr doc = m_refactoringChanges->file(target).cppDocument();