diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 0bee5f811b8fa97bc6abb72fbd0f06a38dbce60a..6c19122e1034155ee36372dbe9ab888f9a7a576c 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -1619,7 +1619,9 @@ void DebuggerPluginPrivate::attachCore()
 {
     AttachCoreDialog dlg(mainWindow());
 
-    dlg.setKitId(Id(configValue(_("LastExternalKit")).toString()));
+    const QString lastExternalKit = configValue(_("LastExternalKit")).toString();
+    if (!lastExternalKit.isEmpty())
+        dlg.setKitId(Id(lastExternalKit));
     dlg.setLocalExecutableFile(configValue(_("LastExternalExecutableFile")).toString());
     dlg.setLocalCoreFile(configValue(_("LastLocalCoreFile")).toString());
     dlg.setRemoteCoreFile(configValue(_("LastRemoteCoreFile")).toString());