mirror of https://github.com/stella-emu/stella.git
Fix crash in Stack::reverse when size is less than 2.
This commit is contained in:
parent
1fc3c62a91
commit
c1781e5492
|
@ -51,8 +51,9 @@ class FixedStack
|
||||||
// Reverse the contents of the stack
|
// Reverse the contents of the stack
|
||||||
// This operation isn't needed very often, but it's handy to have
|
// This operation isn't needed very often, but it's handy to have
|
||||||
void reverse() {
|
void reverse() {
|
||||||
for(uInt32 i = 0, j = _size - 1; i < j; ++i, --j)
|
if(_size > 1)
|
||||||
std::swap(_stack[i], _stack[j]);
|
for(uInt32 i = 0, j = _size - 1; i < j; ++i, --j)
|
||||||
|
std::swap(_stack[i], _stack[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply the given function to every item in the stack
|
// Apply the given function to every item in the stack
|
||||||
|
|
Loading…
Reference in New Issue