From a040cb0c62eca79f7758cbeacc82a8143a2761d2 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sat, 4 May 2013 18:09:40 -0400 Subject: [PATCH] Fix a...strange debug issue. Didn't get this to happen on release testing. --- src/UnlockManager.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/UnlockManager.cpp b/src/UnlockManager.cpp index 7825a8ab5b..b40f5040c4 100644 --- a/src/UnlockManager.cpp +++ b/src/UnlockManager.cpp @@ -565,15 +565,18 @@ void UnlockManager::Load() // Make sure that we don't have duplicate unlock IDs. This can cause problems // with UnlockCelebrate and with codes. unsigned size = m_UnlockEntries.size(); - for (unsigned i = 0; i < size - 1; ++i) + if (size > 1) { - UnlockEntry const &ue1 = m_UnlockEntries[i]; - for (unsigned j = i + 1; j < size; ++j) + for (unsigned i = 0; i < size - 1; ++i) { - UnlockEntry const &ue2 = m_UnlockEntries[j]; - // at this point, these two are definitely different. Assert. - ASSERT_M( ue1.m_sEntryID != ue2.m_sEntryID, ssprintf("duplicate unlock entry id %s", ue1.m_sEntryID.c_str())); + UnlockEntry const &ue1 = m_UnlockEntries[i]; + for (unsigned j = i + 1; j < size; ++j) + { + UnlockEntry const &ue2 = m_UnlockEntries[j]; + // at this point, these two are definitely different. Assert. + ASSERT_M( ue1.m_sEntryID != ue2.m_sEntryID, ssprintf("duplicate unlock entry id %s", ue1.m_sEntryID.c_str())); + } } }