fix: missing range check
When requesting history the `start` parameter could become larger than the loaded events from the database were, resulting in an error when attempting to request history.
This commit is contained in:
parent
1d0202e14e
commit
259c9cade6
|
|
@ -389,8 +389,10 @@ class FamedlySdkHiveDatabase extends DatabaseApi {
|
|||
// Combine those two lists while respecting the start and limit parameters.
|
||||
final end = min(
|
||||
timelineEventIds.length, start + (limit ?? timelineEventIds.length));
|
||||
final eventIds =
|
||||
sendingEventIds + timelineEventIds.getRange(start, end).toList();
|
||||
final eventIds = sendingEventIds +
|
||||
(start < timelineEventIds.length
|
||||
? timelineEventIds.getRange(start, end).toList()
|
||||
: []);
|
||||
|
||||
return await _getEventsByIds(eventIds.cast<String>(), room);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue