mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-03 13:43:31 +02:00
Avoid NPE during content assist with null indexer
This commit is contained in:
parent
6b90a610a5
commit
6b74be4cac
1 changed files with 13 additions and 9 deletions
|
@ -127,10 +127,12 @@ public class CPPASTFieldReference extends CPPASTNode implements
|
|||
|
||||
try {
|
||||
IField[] fields = classType.getFields();
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
char[] potential = fields[i].getNameCharArray();
|
||||
if (CharArrayUtils.equals(potential, 0, name.length, name, false)) {
|
||||
bindings.add(fields[i]);
|
||||
if (fields != null) {
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
char[] potential = fields[i].getNameCharArray();
|
||||
if (CharArrayUtils.equals(potential, 0, name.length, name, false)) {
|
||||
bindings.add(fields[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
|
@ -138,11 +140,13 @@ public class CPPASTFieldReference extends CPPASTNode implements
|
|||
|
||||
try {
|
||||
ICPPMethod[] methods = classType.getMethods();
|
||||
for (int i = 0; i < methods.length; i++) {
|
||||
if (!(methods[i] instanceof ICPPConstructor) && !methods[i].isImplicit()) {
|
||||
char[] potential = methods[i].getNameCharArray();
|
||||
if (CharArrayUtils.equals(potential, 0, name.length, name, false)) {
|
||||
bindings.add(methods[i]);
|
||||
if (methods != null) {
|
||||
for (int i = 0; i < methods.length; i++) {
|
||||
if (!(methods[i] instanceof ICPPConstructor) && !methods[i].isImplicit()) {
|
||||
char[] potential = methods[i].getNameCharArray();
|
||||
if (CharArrayUtils.equals(potential, 0, name.length, name, false)) {
|
||||
bindings.add(methods[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue