summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-09-03 18:02:31 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-09-03 18:02:31 -0400
commit517163c126f7c0620f506532d67d9097083728d9 (patch)
tree88724861192f90ff90a733c478d0770ee944ab95 /indra
parentbf2b2eb01ca8680914d17dda713d9365e2ecc3eb (diff)
Fix a bug in ResultSet::getSliceStart().
When asked to retrieve a slice starting at an `index > 0`, `getSliceStart()` was returning an LLSD array whose first `index` entries were `isUndefined()`, followed by the desired data. Fix to omit those undefined entries.
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/resultset.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/indra/llcommon/resultset.cpp b/indra/llcommon/resultset.cpp
index ee8cc68c6c..cb46db04fa 100644
--- a/indra/llcommon/resultset.cpp
+++ b/indra/llcommon/resultset.cpp
@@ -43,11 +43,14 @@ std::pair<LLSD, int> ResultSet::getSliceStart(int index, int count) const
// overlap [0, length) at all
if (end > start)
{
- // right away expand the result array to the size we'll need
- result[end - 1] = LLSD();
- for (int i = start; i < end; ++i)
+ // Right away expand the result array to the size we'll need.
+ // (end - start) is that size; (end - start - 1) is the index of the
+ // last entry in result.
+ result[end - start - 1] = LLSD();
+ for (int i = 0; (start + i) < end; ++i)
{
- result[i] = getSingle(i);
+ // For this to be a slice, set result[0] = getSingle(start), etc.
+ result[i] = getSingle(start + i);
}
}
return { result, start };