Skip to content

Commit

Permalink
fix: handle null fields in sync-v2 response (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
luislhl authored Jul 2, 2024
1 parent 72af0f4 commit 25df1a9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/Network.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class Network extends React.Component {
const server_best_block = this.state.best_block;
const {peer_best_block, synced_block} = conn;

if (server_best_block) {
if (server_best_block && synced_block && peer_best_block) {
progress = synced_block.height / server_best_block.height;
if (server_best_block.id === synced_block.id) {
state = SyncStates.IN_SYNC;
Expand All @@ -124,6 +124,8 @@ class Network extends React.Component {
} else if (peer_best_block.height > server_best_block.height) {
state = SyncStates.AHEAD;
}
} else {
state = SyncStates.UNKNOWN;
}
return {
progress,
Expand Down

0 comments on commit 25df1a9

Please sign in to comment.