From 09931ae0aa11aafa8ad6324a92fafd1fbcd678af Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 16 Sep 2017 14:09:28 -0400 Subject: TITANIC: Fixed FixedQueue compaction when queue has been emptied --- engines/titanic/support/fixed_queue.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'engines/titanic') 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; } -- cgit v1.2.3