This repository was archived by the owner on Aug 1, 2025. It is now read-only.
Commit 500654c
authored
Fix NPE exception reported by Sentry (#8188)
## Changes
Fix for the NPE in the `CodyElementListenerProvider` reported by Sentry:
```
Cannot invoke "com.intellij.psi.PsiFile.getVirtualFile()" because the return value of "com.intellij.psi.PsiElement.getContainingFile()" is null
com.sourcegraph.cody.listeners.CodyElementListenerProvider in getListener at line 12
In App
com.intellij.refactoring.listeners.impl.RefactoringTransactionImpl in addAffectedElement at line 46
com.intellij.refactoring.listeners.impl.RefactoringTransactionImpl$MyRefactoringElementListener in <init> at line 73
(...)
```
## Test plan
I'm not sure how to replicate the issue but the source of the problem is
pretty clear.
<!-- Required. See
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles.
-->1 parent a58b4b3 commit 500654c
1 file changed
Lines changed: 11 additions & 2 deletions
File tree
- jetbrains/src/main/kotlin/com/sourcegraph/cody/listeners
jetbrains/src/main/kotlin/com/sourcegraph/cody/listeners/CodyElementRefactoringListenerProvider.kt
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
18 | 27 | | |
19 | | - | |
| 28 | + | |
20 | 29 | | |
21 | 30 | | |
22 | 31 | | |
| |||
0 commit comments