Skip to content

Error processing file #862

Description

@justpav05

I encountered an error while working with a file: during editing, the program crashed while attempting to unwrap a value that was None

Image

When navigating focus elements, the editor panics with:

thread 'main' panicked at crates/edit/src/tui.rs:1537:59:
called Option::unwrap() on a None value

The issue is in the focus traversal loop:

focused_start = focused_start.borrow().parent.unwrap();

If a node has no parent and ptr::eq(focused_start, focus_well) doesn't catch it first, unwrap() panics.

Suggested fix:

focused_start = match focused_start.borrow().parent.clone() {
    Some(p) => p,
    None => break,
};

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions