mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
fix(settings): prevent signed overflow and associated warning
This commit is contained in:
parent
2f13796acc
commit
6d1b1f62ab
|
@ -262,7 +262,9 @@ void SettingsSerializer::save()
|
||||||
QDataStream stream(&data, QIODevice::ReadWrite | QIODevice::Append);
|
QDataStream stream(&data, QIODevice::ReadWrite | QIODevice::Append);
|
||||||
stream.setVersion(QDataStream::Qt_5_0);
|
stream.setVersion(QDataStream::Qt_5_0);
|
||||||
|
|
||||||
for (int g = -1; g < groups.size(); ++g) {
|
// prevent signed overflow and the associated warning
|
||||||
|
int numGroups = std::max(0, groups.size());
|
||||||
|
for (int g = -1; g < numGroups; ++g) {
|
||||||
// Save the group name, if any
|
// Save the group name, if any
|
||||||
if (g != -1) {
|
if (g != -1) {
|
||||||
writeStream(stream, RecordTag::GroupStart);
|
writeStream(stream, RecordTag::GroupStart);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user