From f111c006ced656d98279b4fef6b7fab9576d26fc Mon Sep 17 00:00:00 2001 From: Antoni Spaanderman <56turtle56@gmail.com> Date: Mon, 24 Jan 2022 20:26:02 +0100 Subject: [PATCH] fix block height out of range on full page blocks viewer --- .../app/components/latest-blocks/latest-blocks.component.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/components/latest-blocks/latest-blocks.component.ts b/frontend/src/app/components/latest-blocks/latest-blocks.component.ts index cef512388..5bdb55ece 100644 --- a/frontend/src/app/components/latest-blocks/latest-blocks.component.ts +++ b/frontend/src/app/components/latest-blocks/latest-blocks.component.ts @@ -109,8 +109,12 @@ export class LatestBlocksComponent implements OnInit, OnDestroy { if (this.isLoading) { return; } + const height = this.blocks[this.blocks.length - 1].height - 1; + if (height < 0) { + return; + } this.isLoading = true; - this.electrsApiService.listBlocks$(this.blocks[this.blocks.length - 1].height - 1) + this.electrsApiService.listBlocks$(height) .subscribe((blocks) => { this.blocks = this.blocks.concat(blocks); this.isLoading = false;