From f55632fccc34d8dc1e1d452d3fb118a2ddefb315 Mon Sep 17 00:00:00 2001
From: dt <qtc-committer@nokia.com>
Date: Thu, 18 Jun 2009 14:57:52 +0200
Subject: [PATCH] If we can't figure out the mimetype, fall back to text/plain.

We are after all a text editor on steroids. That is people might want to
edit text files that don't have a ending we know.
---
 src/plugins/coreplugin/editormanager/editormanager.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index 3df5b510f10..e235e09acc9 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -992,11 +992,11 @@ IEditor *EditorManager::createEditor(const QString &editorKind,
     EditorFactoryList factories;
     if (editorKind.isEmpty()) {
         // Find by mime type
-        const MimeType mimeType = m_d->m_core->mimeDatabase()->findByFile(QFileInfo(fileName));
+        MimeType mimeType = m_d->m_core->mimeDatabase()->findByFile(QFileInfo(fileName));
         if (!mimeType) {
-            qWarning("%s unable to determine mime type of %s/%s.",
+            qWarning("%s unable to determine mime type of %s/%s. Falling back to text/plain",
                      Q_FUNC_INFO, fileName.toUtf8().constData(), editorKind.toUtf8().constData());
-            return 0;
+            mimeType = m_d->m_core->mimeDatabase()->findByType(QLatin1String("text/plain"));
         }
         factories = editorFactories(mimeType, true);
     } else {
-- 
GitLab