From 517163c126f7c0620f506532d67d9097083728d9 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 3 Sep 2024 18:02:31 -0400 Subject: 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. --- indra/llcommon/resultset.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'indra') 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 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 }; -- cgit v1.2.3