Skip to content

Commit 2c9b22d

Browse files
committed
fix possible npe in ParameterLookupElement #351
1 parent 4f80f98 commit 2c9b22d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/fr/adrienbrault/idea/symfony2plugin/config/component/ParameterLookupElement.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
*/
1515
public class ParameterLookupElement extends LookupElement {
1616

17-
private String parameterKey;
18-
private String parameterValue;
1917
private Object psiElement;
2018
private InsertHandler<LookupElement> insertHandler = null;
2119
private ContainerParameter containerParameter;
@@ -27,6 +25,7 @@ public ParameterLookupElement(ContainerParameter containerParameter) {
2725
public ParameterLookupElement(ContainerParameter containerParameter, InsertHandler<LookupElement> insertHandler, Object psiElement) {
2826
this.insertHandler = insertHandler;
2927
this.psiElement = psiElement;
28+
this.containerParameter = containerParameter;
3029
}
3130

3231
@NotNull
@@ -44,14 +43,15 @@ public void handleInsert(InsertionContext context) {
4443
@NotNull
4544
@Override
4645
public String getLookupString() {
47-
return parameterKey;
46+
return containerParameter.getName();
4847
}
4948

5049
public void renderElement(LookupElementPresentation presentation) {
5150
presentation.setItemText(getLookupString());
5251

53-
if(parameterValue != null && !StringUtils.isBlank(parameterValue)) {
54-
presentation.setTypeText(parameterValue);
52+
String value = containerParameter.getValue();
53+
if(value != null && StringUtils.isNotBlank(value)) {
54+
presentation.setTypeText(value);
5555
}
5656

5757
presentation.setTypeGrayed(true);

0 commit comments

Comments
 (0)