diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index b073c36ab9d26e49340ead4467868b35ddd9b8f7..9b07cd92d836fe73f222256140d210ac5819b592 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -1797,7 +1797,7 @@ QString EditorManager::fileNameForEditor(IEditor *editor)
 
     if (editor) {
         if (!editor->document()->fileName().isEmpty()) {
-            QFileInfo fileInfo(curEditor->document()->fileName());
+            QFileInfo fileInfo(editor->document()->fileName());
             fileName = fileInfo.fileName();
         } else {
             fileName = editor->displayName();