summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Bugge Monsen <mmonsen@trolltech.com>2009-11-27 15:22:05 +0100
committerMarius Bugge Monsen <mmonsen@trolltech.com>2009-11-27 15:22:05 +0100
commit7ecb73c5ddf81d04f609462bbe8b9e740b59551a (patch)
tree4939f6903c3d9de8990a32bbcba79fdf1c386956
parentcbde1fa757dbffaa71c2f0c40216809860cf3818 (diff)
Fix out-of-bounds error.
-rw-r--r--examples/chat/chatmodel.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/chat/chatmodel.cpp b/examples/chat/chatmodel.cpp
index 6ee2927..e21a522 100644
--- a/examples/chat/chatmodel.cpp
+++ b/examples/chat/chatmodel.cpp
@@ -246,8 +246,9 @@ void ChatModel::timerEvent(QTimerEvent *event)
static int i = 0;
if (event->timerId() == timerId) {
int index = i++;
- appendMessage(conversation[index].second, conversation[index].first);
- if (index >= 153) {
+ if (index < 153) {
+ appendMessage(conversation[index].second, conversation[index].first);
+ } else {
killTimer(timerId);
timerId = 0;
}