Skip to content

[Bug]: Unreachable code - inner if condition always false in blocks.js #6479

@karthik-dev56

Description

@karthik-dev56

Description

In js/blocks.js, there is unreachable/dead code where an inner if condition is always false because it contradicts the outer while loop condition.

Location

File: js/blocks.js
Lines: 1418-1421

Bug Details

while (block?.name == "vspace") {
    if (block?.name != "vspace") {  // BUG: Always false - contradicts while condition
        break;                       // DEAD CODE: Never executes
    }
    block = this.blockList[block.connections[0]];
    if (block?.name == "newnote") {
        return;
    }
}

Problem

  • The while loop condition checks block?.name == "vspace"
  • Inside the loop, the if checks block?.name != "vspace"
  • This if condition is always false because we just confirmed the opposite in the while
  • The break statement is dead code that can never execute

Expected Behavior

  • The inner if block should be removed as it serves no purpose.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions