Browse Source

fix(settings): prevent signed overflow and associated warning

reviewable/pr4744/r1
sudden6 8 years ago
parent
commit
6d1b1f62ab
No known key found for this signature in database
GPG Key ID: 279509B499E032B9
  1. 4
      src/persistence/settingsserializer.cpp

4
src/persistence/settingsserializer.cpp

@ -262,7 +262,9 @@ void SettingsSerializer::save() @@ -262,7 +262,9 @@ void SettingsSerializer::save()
QDataStream stream(&data, QIODevice::ReadWrite | QIODevice::Append);
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
if (g != -1) {
writeStream(stream, RecordTag::GroupStart);

Loading…
Cancel
Save