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:
parent
adad71e565
commit
036d307302
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user