diff options
author | mtklein <mtklein@chromium.org> | 2014-09-11 06:36:11 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-11 06:36:11 -0700 |
commit | aa90d00f14414db39b3d990d8d5fd594d6eadc6e (patch) | |
tree | 386807526b6c35e93e9747a029ad7805f0aa971b | |
parent | 26a4b514999dcbd8c6a4a2e85bcc5dbd55f02236 (diff) |
Assert SkTDArray::pop() doesn't underflow.
BUG=skia:
R=reed@google.com, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/563633003
-rw-r--r-- | include/core/SkTDArray.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/include/core/SkTDArray.h b/include/core/SkTDArray.h index 4c90460b94..92f297c31a 100644 --- a/include/core/SkTDArray.h +++ b/include/core/SkTDArray.h @@ -282,12 +282,12 @@ public: } // routines to treat the array like a stack - T* push() { return this->append(); } - void push(const T& elem) { *this->append() = elem; } - const T& top() const { return (*this)[fCount - 1]; } - T& top() { return (*this)[fCount - 1]; } - void pop(T* elem) { if (elem) *elem = (*this)[fCount - 1]; --fCount; } - void pop() { --fCount; } + T* push() { return this->append(); } + void push(const T& elem) { *this->append() = elem; } + const T& top() const { return (*this)[fCount - 1]; } + T& top() { return (*this)[fCount - 1]; } + void pop(T* elem) { SkASSERT(fCount > 0); if (elem) *elem = (*this)[fCount - 1]; --fCount; } + void pop() { SkASSERT(fCount > 0); --fCount; } void deleteAll() { T* iter = fArray; |