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
This commit is contained in:
mtklein 2014-09-11 06:36:11 -07:00 committed by Commit bot
parent 26a4b51499
commit aa90d00f14

View File

@ -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;