Skip to content

Commit 3ee2691

Browse files
authored
Merge pull request #186 from SeeSharpSoft/fb_infomap_nullpointer
[FIX] NullPointerException thrown when trying to view CSV as table #185
2 parents b5f8712 + 8e9fd36 commit 3ee2691

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/table/CsvTableEditor.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,12 +343,19 @@ public final void adjustAllColumnWidths() {
343343
}
344344

345345
protected final void setAllColumnWidths(int[] widths) {
346+
if (widths == null) {
347+
return;
348+
}
346349
getFileEditorState().setColumnWidths(widths);
347350
updateEditorLayout();
348351
}
349352

350353
protected int[] calculateDistributedColumnWidths() {
351-
Map<Integer, CsvColumnInfo<PsiElement>> columnInfos = this.getColumnInfoMap().getColumnInfos();
354+
CsvColumnInfoMap csvColumnInfoMap = this.getColumnInfoMap();
355+
if (csvColumnInfoMap == null) {
356+
return null;
357+
}
358+
Map<Integer, CsvColumnInfo<PsiElement>> columnInfos = csvColumnInfoMap.getColumnInfos();
352359
Object[][] data = getDataHandler().getCurrentState();
353360
int[] widths = new int[columnInfos.size()];
354361
int tableAutoMaxColumnWidth = CsvEditorSettings.getInstance().getTableAutoMaxColumnWidth();

0 commit comments

Comments
 (0)