Skip to content

redo() missing null guard that undo() has, will crash if no graph #327

@avinxshKD

Description

@avinxshKD

in toolbarFunctions.js around line 177:

const undo = (state) => {
    if (getGraphFun(state)) getGraphFun(state).undo();  // has guard
};
const redo = (state) => {
    getGraphFun(state).redo();  // no guard
};

undo checks if graph exists before calling .undo(), redo just yolos it. will throw if curGraphInstance is null/undefined. probably just copy-paste miss when these were written.

fix could be,,. add the same if (getGraphFun(state)) check

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