summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarius Bugge Monsen <mmonsen@trolltech.com>2009-06-29 14:38:36 +0200
committerMarius Bugge Monsen <mmonsen@trolltech.com>2009-06-29 14:38:36 +0200
commit977d888da5fce72c34e6bc64c8bd965f30841010 (patch)
tree9f67134696c94028d164f3d8c56a680a05630f33 /src
parent229a327898b34ec1ed7abb7c430b7b9f539f13ca (diff)
Add some autotest data for QtSectionSpans.
Fix boundry issues discoverd in QtSectionSpans by the above test.
Diffstat (limited to 'src')
-rw-r--r--src/qsectionspans_p.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qsectionspans_p.h b/src/qsectionspans_p.h
index 5636c9f..7d67ef8 100644
--- a/src/qsectionspans_p.h
+++ b/src/qsectionspans_p.h
@@ -216,8 +216,8 @@ public:
if (index >= spanFirstSection && index <= spanLastSection) {
// can we remove the span ?
if (index == spanFirstSection && spanSectionCount <= uint(removeCount)) {
- int prev = i - 1;
- int next = i + 1;
+ int prev = qMax(i - 1, 0); // if 'i' is 0, it doesn't matter
+ int next = qMin(i + 1, spans.count() - 1);
bool merge = (spans.at(prev).value == spans.at(next).value);
if (merge) {
spans[prev].count += spans.at(next).count;