diff --git a/backend/src/routes.ts b/backend/src/routes.ts index 1d98c9f4e..b642f6c28 100644 --- a/backend/src/routes.ts +++ b/backend/src/routes.ts @@ -567,7 +567,7 @@ class Routes { } let nextHash = startFromHash; - for (let i = 0; i < 10; i++) { + for (let i = 0; i < 10 && nextHash; i++) { const localBlock = blocks.getBlocks().find((b) => b.id === nextHash); if (localBlock) { returnBlocks.push(localBlock);