1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Handle personnal save corruption better

This commit is contained in:
tux3 2015-06-06 20:53:31 +02:00
parent adad71e565
commit 036d307302
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -364,6 +364,11 @@ void SettingsSerializer::readSerialized()
beginReadArray(QString::fromUtf8(prefix)); beginReadArray(QString::fromUtf8(prefix));
QByteArray sizeData; QByteArray sizeData;
stream >> sizeData; stream >> sizeData;
if (sizeData.isEmpty())
{
qWarning("The personnal save file is corrupted!");
return;
}
quint64 size = dataToVUint(sizeData); quint64 size = dataToVUint(sizeData);
arrays[array].size = max(size, arrays[array].size); arrays[array].size = max(size, arrays[array].size);
//qDebug()<<"!Array start"<<prefix; //qDebug()<<"!Array start"<<prefix;
@ -372,6 +377,11 @@ void SettingsSerializer::readSerialized()
{ {
QByteArray indexData; QByteArray indexData;
stream >> indexData; stream >> indexData;
if (indexData.isEmpty())
{
qWarning("The personnal save file is corrupted!");
return;
}
quint64 index = dataToVUint(indexData); quint64 index = dataToVUint(indexData);
setArrayIndex(index); setArrayIndex(index);
QByteArray key; QByteArray key;