Merge pull request #381 from vector-im/bwindels/fix-fail-to-load-at-top-with-zero-entries

Don't assume there is at least 1 tile before loading at top
This commit is contained in:
Bruno Windels 2021-06-03 07:27:49 +00:00 committed by GitHub
commit 41b4c31a7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -52,7 +52,7 @@ export class TimelineViewModel extends ViewModel {
return true;
}
const firstTile = this._tiles.getFirst();
if (firstTile.shape === "gap") {
if (firstTile?.shape === "gap") {
return await firstTile.fill();
} else {
const topReached = await this._timeline.loadAtTop(10);