error handling when out of file
This commit is contained in:
parent
8346e5916d
commit
ff08ee7cea
|
@ -87,16 +87,10 @@ void MshFile::loadChunks(QList<ChunkHeader*>& destination, qint64 start, const q
|
||||||
destination.push_back(tmp_header);
|
destination.push_back(tmp_header);
|
||||||
|
|
||||||
// jump to next header
|
// jump to next header
|
||||||
if (!m_file.seek(tmp_header->size + m_file.pos()))
|
m_file.seek(tmp_header->size + m_file.pos());
|
||||||
{
|
|
||||||
OutputDevice::getInstance()->print("WARNING: corrupted file. Trying to continue..", 1);
|
|
||||||
m_file.unsetError();
|
|
||||||
m_file.seek(0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// out of file. Maybe a size information is corrupted
|
// out of file. Maybe a size information is corrupted
|
||||||
if (m_file.error() != QFileDevice::NoError)
|
if (m_file.atEnd() || m_file.error() != QFileDevice::NoError)
|
||||||
{
|
{
|
||||||
OutputDevice::getInstance()->print("WARNING: corrupted file. Trying to continue..", 1);
|
OutputDevice::getInstance()->print("WARNING: corrupted file. Trying to continue..", 1);
|
||||||
m_file.unsetError();
|
m_file.unsetError();
|
||||||
|
|
Loading…
Reference in New Issue