mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 421041 - NPE in EvalBinding.getBinding
This happens when constructor EvalBinding(IBinding binding, IType type, IBinding templateDefinition) is called with a null binding. A binding can be null for example when TypeMarshalBuffer.unmarshalBinding returns null. Instead of returning null, unmarshalBinding can return a ProblemBinding and the assumptions that the binding in EvalBinding is not null can be maintained. Change-Id: Icebf875e059f2962cc2ddd91d3b79c51b88eddac Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com> Reviewed-on: https://git.eclipse.org/r/18064
This commit is contained in:
parent
73a912f95b
commit
f6fcccfcad
1 changed files with 3 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2009, 2012 Wind River Systems, Inc. and others.
|
* Copyright (c) 2009, 2014 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -21,6 +21,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableType;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
|
import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateNonTypeArgument;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateNonTypeArgument;
|
||||||
|
@ -106,7 +107,7 @@ public final class TypeMarshalBuffer implements ITypeMarshalBuffer {
|
||||||
long rec= getRecordPointer();
|
long rec= getRecordPointer();
|
||||||
return (IBinding) PDOMNode.load(fLinkage.getPDOM(), rec);
|
return (IBinding) PDOMNode.load(fLinkage.getPDOM(), rec);
|
||||||
} else if (firstBytes == NULL_TYPE || firstBytes == UNSTORABLE_TYPE) {
|
} else if (firstBytes == NULL_TYPE || firstBytes == UNSTORABLE_TYPE) {
|
||||||
return null;
|
return new ProblemBinding(null, ISemanticProblem.TYPE_NOT_PERSISTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
fPos = oldPos; // fLinkage.unmarshalBinding() will read firstBytes again
|
fPos = oldPos; // fLinkage.unmarshalBinding() will read firstBytes again
|
||||||
|
|
Loading…
Add table
Reference in a new issue