fixed out of file check order
This commit is contained in:
		@@ -74,6 +74,15 @@ void MshFile::loadChunks(QList<ChunkHeader*>& destination, qint64 start, const q
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	do
 | 
						do
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
							// out of file. Maybe a size information is corrupted
 | 
				
			||||||
 | 
							if (m_file.atEnd() || m_file.error() != QFileDevice::NoError)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								OutputDevice::getInstance()->print("WARNING: corrupted file. Trying to continue..", 1);
 | 
				
			||||||
 | 
								m_file.unsetError();
 | 
				
			||||||
 | 
								m_file.seek(0);
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ChunkHeader* tmp_header = new ChunkHeader();
 | 
							ChunkHeader* tmp_header = new ChunkHeader();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		char workaround[5] = { 0 };
 | 
							char workaround[5] = { 0 };
 | 
				
			||||||
@@ -89,14 +98,6 @@ void MshFile::loadChunks(QList<ChunkHeader*>& destination, qint64 start, const q
 | 
				
			|||||||
		// jump to next header
 | 
							// jump to next header
 | 
				
			||||||
		m_file.seek(tmp_header->size + m_file.pos());
 | 
							m_file.seek(tmp_header->size + m_file.pos());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// out of file. Maybe a size information is corrupted
 | 
					 | 
				
			||||||
		if (m_file.atEnd() || m_file.error() != QFileDevice::NoError)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			OutputDevice::getInstance()->print("WARNING: corrupted file. Trying to continue..", 1);
 | 
					 | 
				
			||||||
			m_file.unsetError();
 | 
					 | 
				
			||||||
			m_file.seek(0);
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	} while (m_file.pos() - start != length);
 | 
						} while (m_file.pos() - start != length);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user