Skip to content

Commit 2072c45

Browse files
committed
FIX: Argument for @NotNull parameter 'element' of net/seesharpsoft/intellij/psi/PsiHelper.getSiblingOfType must not be null #375
1 parent b994418 commit 2072c45

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/net/seesharpsoft/intellij/plugins/csv/psi/CsvPsiTreeUpdater.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,16 @@ public void deleteRow(@NotNull PsiElement row) {
262262
}
263263

264264
public void deleteRows(Collection<Integer> indices) {
265-
Set<PsiElement> toDelete = new HashSet<>();
266265
PsiFile psiFile = getPsiFile();
266+
if (psiFile == null) return;
267+
268+
Set<PsiElement> toDelete = new HashSet<>();
267269
List<Integer> sortedIndices = new ArrayList<>(indices);
268270
Collections.sort(sortedIndices);
269271
for (int rowIndex : sortedIndices) {
270272
CsvRecord row = PsiHelper.getNthChildOfType(psiFile, rowIndex, CsvRecord.class);
273+
if (row == null) continue;
274+
271275
boolean removePreviousLF = rowIndex > 0;
272276
PsiElement lf = PsiHelper.getSiblingOfType(row, CsvTypes.CRLF, removePreviousLF);
273277
if (lf == null || toDelete.contains(lf)) {

0 commit comments

Comments
 (0)