aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2017-09-16 14:09:28 -0400
committerPaul Gilbert2017-09-16 14:09:28 -0400
commit09931ae0aa11aafa8ad6324a92fafd1fbcd678af (patch)
treea66ac1298bdb273c480a100302611476565c4ab3
parentbbbbfb64dc9ce6770a8a0691921054f8c39a9019 (diff)
downloadscummvm-rg350-09931ae0aa11aafa8ad6324a92fafd1fbcd678af.tar.gz
scummvm-rg350-09931ae0aa11aafa8ad6324a92fafd1fbcd678af.tar.bz2
scummvm-rg350-09931ae0aa11aafa8ad6324a92fafd1fbcd678af.zip
TITANIC: Fixed FixedQueue compaction when queue has been emptied
-rw-r--r--engines/titanic/support/fixed_queue.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/engines/titanic/support/fixed_queue.h b/engines/titanic/support/fixed_queue.h
index a7ba6eac2c..dbcbeb669c 100644
--- a/engines/titanic/support/fixed_queue.h
+++ b/engines/titanic/support/fixed_queue.h
@@ -80,7 +80,8 @@ public:
*/
void compact() {
if (_data.size() == MAX_SIZE && _topIndex > 0) {
- Common::copy(&_data[_topIndex], &_data[0] + MAX_SIZE, &_data[0]);
+ if (_topIndex < MAX_SIZE)
+ Common::copy(&_data[_topIndex], &_data[0] + MAX_SIZE, &_data[0]);
_data.resize(size());
_topIndex = 0;
}