Skip to content

Spreadsheet throws exception when deleteRows is called and no cell is selected in the spreadsheet #842

@KochTobi

Description

@KochTobi

The method deleteRows produces a NullPointerException.
java.lang.NullPointerException: Cannot invoke "org.apache.poi.ss.util.CellReference.getRow()" because "selectedCellReference" is null

https://github.com/vaadin/spreadsheet/blob/317684df11cdb37c29ca5824afc756584aa714e2/vaadin-spreadsheet/src/main/java/com/vaadin/addon/spreadsheet/Spreadsheet.java#L2357C10-L2357C10

Here, the cell reference of the currently selected cell is used. There is no check for null here, so when no cell is selected, deleting rows is not possible and an exception is thrown.
This should not be the case.
You should be able to delete rows without selecting a cell first (using a button in the UI or something else that uses the java API).

Vaadin version: 24.1.6
Java Version: 17.0.7 Zulu

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