aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic')
-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;
}