Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: canRequestHistory is true while requestHistory throws an excepti… #1595

Closed

Conversation

krille-chan
Copy link
Contributor

…on when events is empty

@@ -75,7 +75,6 @@ class Timeline {
bool _collectHistoryUpdates = false;

bool get canRequestHistory {
if (events.isEmpty) return true;
return room.prev_batch != null && events.last.type != EventTypes.RoomCreate;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can only access events.last, if events is not empty.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the normal room history, events should never have to be empty, since we should always be able to request our own history for our join event at least. This also might cause issues, since possibly on the first history pagination a timeline has no prev_batch token and is empty, if you just want to request the history for an arbitrary room? Not sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay true, somehow I have missread the whole method. Will close this then

@krille-chan krille-chan closed this Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants