diff options
author | John Ehresman <jpe@wingware.com> | 2012-03-30 15:11:57 -0400 |
---|---|---|
committer | Hugo Parente Lima <hugo.lima@openbossa.org> | 2012-06-14 21:23:45 +0200 |
commit | 8bce7870aebd415a3d842cda3c29b82461802214 (patch) | |
tree | 3928382bc8bf0f54d7a9210fd14e5f79c37f2db7 /tests | |
parent | e40e993cecd1663636e2f0d33b3e2a6204d64984 (diff) |
Don't use it->second after erasing it
Change-Id: I77bda667d4119a7982ec93175ff0b3153277ad8e
Reviewed-by: Hugo Parente Lima <hugo.lima@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/libsample/blackbox.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/libsample/blackbox.cpp b/tests/libsample/blackbox.cpp index 474a605fb..95fb88c29 100644 --- a/tests/libsample/blackbox.cpp +++ b/tests/libsample/blackbox.cpp @@ -53,8 +53,9 @@ BlackBox::retrieveObjectType(int ticket) { map<int, ObjectType*>::iterator it = m_objects.find(ticket); if (it != m_objects.end()) { + ObjectType* second = it->second; m_objects.erase(it); - return it->second; + return second; } return 0; } @@ -82,8 +83,9 @@ BlackBox::retrievePoint(int ticket) { map<int, Point*>::iterator it = m_points.find(ticket); if (it != m_points.end()) { + Point* second = it->second; m_points.erase(it); - return it->second; + return second; } return 0; } |