evrencoskun / TableView

TableView is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells.
MIT License
3.13k stars 453 forks source link

Wrong number of cells in a row crashes #401

Open pe1uca opened 2 years ago

pe1uca commented 2 years ago

Is your feature request related to a problem? Please describe. Because of a mistake I made when migrating from another table library, I left an extra column cell (old library's corner)
This makes TableView to crash here with a NullPointerException https://github.com/evrencoskun/TableView/blob/cf9c7f66e764aee2c6f30df816ca21c270ecd01a/tableview/src/main/java/com/evrencoskun/tableview/layoutmanager/ColumnHeaderLayoutManager.java#L96-L99

Describe the solution you'd like Make TableView library gracefully handle this case.
When commenting this line I was able to prevent the app from crashing https://github.com/evrencoskun/TableView/blob/cf9c7f66e764aee2c6f30df816ca21c270ecd01a/tableview/src/main/java/com/evrencoskun/tableview/layoutmanager/CellLayoutManager.java#L258

The table will look wrong, but I think is better than the misleading NullPointerException.

Additional context I followed the wiki for this example, only replacing object by string as data.