[Box Backup-dev] COMMIT r266 - box/chris/win32/vc2005-compile-fixes/lib/win32

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Thu, 22 Dec 2005 02:09:06 +0000 (GMT)


Author: chris
Date: 2005-12-22 02:09:03 +0000 (Thu, 22 Dec 2005)
New Revision: 266

Modified:
   box/chris/win32/vc2005-compile-fixes/lib/win32/emu.cpp
Log:
Fixed incorrect use of list iterator


Modified: box/chris/win32/vc2005-compile-fixes/lib/win32/emu.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/win32/emu.cpp	2005-12-22 00:39:44 UTC (rev 265)
+++ box/chris/win32/vc2005-compile-fixes/lib/win32/emu.cpp	2005-12-22 02:09:03 UTC (rev 266)
@@ -104,8 +104,13 @@
 			if (rTimer.countDown == -1)
 			{
 				gTimerList.erase(it);
-				//if we don't do this the search is on a corrupt list
+				
+				// the iterator is now invalid, so restart search
 				it = gTimerList.begin();
+
+				// if the list is now empty, don't try to increment 
+				// the iterator again
+				if (it == gTimerList.end()) break;
 			}
 		}