mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-03-01 03:30:04 +00:00
Address fragility in importing spreadsheets with missing header columns
This commit is contained in:
parent
0be1b6fe3e
commit
269580cf11
@ -116,12 +116,13 @@ public class SheetEditorControllerImpl extends SheetEditorController {
|
|||||||
}).collect(Collectors.toCollection(editor.getSheet().getColumns()::getColumn));
|
}).collect(Collectors.toCollection(editor.getSheet().getColumns()::getColumn));
|
||||||
|
|
||||||
editor.getSheet().setRows(new Rows());
|
editor.getSheet().setRows(new Rows());
|
||||||
|
List<String> header = data.get(0);
|
||||||
data.stream().skip(1)
|
data.stream().skip(1)
|
||||||
.map(cols -> {
|
.map(cols -> {
|
||||||
Row r = new Row();
|
Row r = new Row();
|
||||||
for (int i = 0; i < cols.size(); i++) {
|
for (int i = 0; i < cols.size(); i++) {
|
||||||
if (cols.get(i) != null) {
|
if (cols.get(i) != null && header.size() > i && header.get(i) != null) {
|
||||||
setValue(r.getOtherAttributes(), data.get(0).get(i), cols.get(i));
|
setValue(r.getOtherAttributes(), header.get(i), cols.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user