@@ -108,8 +108,11 @@ public CsvColumnInfoMap<PsiElement> getColumnInfoMap() {
108
108
}
109
109
110
110
public boolean hasErrors () {
111
+ if (!isValid ()) {
112
+ return true ;
113
+ }
111
114
CsvColumnInfoMap columnInfoMap = getColumnInfoMap ();
112
- return ! isValid () || (columnInfoMap != null && columnInfoMap .hasErrors ());
115
+ return (columnInfoMap != null && columnInfoMap .hasErrors ());
113
116
}
114
117
115
118
protected Object [][] storeStateChange (Object [][] data ) {
@@ -129,7 +132,8 @@ public void saveChanges(final String content) {
129
132
return ;
130
133
}
131
134
ApplicationManager .getApplication ().invokeLater (() -> {
132
- if (!this .document .isWritable () && ReadonlyStatusHandler .getInstance (this .project ).ensureFilesWritable (this .file ).hasReadonlyFiles ()) {
135
+ if (project == null || project .isDisposed () ||
136
+ (!this .document .isWritable () && ReadonlyStatusHandler .getInstance (this .project ).ensureFilesWritable (this .file ).hasReadonlyFiles ())) {
133
137
return ;
134
138
}
135
139
ApplicationManager .getApplication ().runWriteAction (() ->
@@ -206,6 +210,9 @@ public boolean isModified() {
206
210
207
211
@ Override
208
212
public boolean isValid () {
213
+ if (file == null || !file .isValid ()) {
214
+ return false ;
215
+ }
209
216
CsvFile csvFile = this .getCsvFile ();
210
217
return csvFile != null && csvFile .isValid ();
211
218
}
@@ -277,7 +284,7 @@ public int compareTo(@NotNull FileEditorLocation o) {
277
284
278
285
@ Nullable
279
286
public StructureViewBuilder getStructureViewBuilder () {
280
- return file != null && file . isValid () ? StructureViewBuilder .PROVIDER .getStructureViewBuilder (file .getFileType (), file , this .project ) : null ;
287
+ return isValid () ? StructureViewBuilder .PROVIDER .getStructureViewBuilder (file .getFileType (), file , this .project ) : null ;
281
288
}
282
289
283
290
@ Nullable
@@ -292,6 +299,9 @@ public Project getProject() {
292
299
293
300
@ Nullable
294
301
public final CsvFile getCsvFile () {
302
+ if (project == null || project .isDisposed ()) {
303
+ return null ;
304
+ }
295
305
if (this .psiFile == null || !this .psiFile .isValid ()) {
296
306
this .document = FileDocumentManager .getInstance ().getDocument (this .file );
297
307
PsiDocumentManager documentManager = PsiDocumentManager .getInstance (project );
0 commit comments