1
0
Fork 0
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:
Anton Leherbauer 2007-02-07 11:14:22 +00:00
parent 6b90a610a5
commit 6b74be4cac

View file

@ -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]);
}
}
}
}