texteditor: don't crash when trying to open too large files

Task-number: QTCREATORBUG-3828
This commit is contained in:
hjk
2011-02-22 16:26:45 +01:00
parent 07d6a7ef1e
commit 89884d823d

View File

@@ -444,7 +444,12 @@ bool BaseTextDocument::open(const QString &fileName)
title = fi.fileName();
QByteArray buf = file.readAll();
QByteArray buf;
try {
buf = file.readAll();
} catch (std::bad_alloc) {
return false;
}
int bytesRead = buf.size();
QTextCodec *codec = d->m_codec;