From eade228c24bfb5e6d77fc725f474ff2da9e6242c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 3 Jun 2007 17:09:15 +0000 Subject: [PATCH] CheckMemoryLeak: Bug fix. --- CheckMemoryLeak.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/CheckMemoryLeak.cpp b/CheckMemoryLeak.cpp index 136099e2b..1e5b719f4 100644 --- a/CheckMemoryLeak.cpp +++ b/CheckMemoryLeak.cpp @@ -84,19 +84,28 @@ void CheckMemoryLeak() } // if level.. - if (iflist.back()) - iflevel--; - iflist.pop_back(); + if ( ! iflist.empty() ) + { + if (iflist.back()) + iflevel--; + iflist.pop_back(); + } // loop level.. - if (looplist.back()) - looplevel--; - looplist.pop_back(); + if ( ! looplist.empty() ) + { + if (looplist.back()) + looplevel--; + looplist.pop_back(); + } // switch level.. - if (switchlist.back()) - switchlevel--; - switchlist.pop_back(); + if ( ! switchlist.empty() ) + { + if (switchlist.back()) + switchlevel--; + switchlist.pop_back(); + } // Make sure the varlist is empty.. if (indentlevel <= 1)