Commit 89884d82 authored by hjk's avatar hjk
Browse files

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

Task-number: QTCREATORBUG-3828
parent 07d6a7ef
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment