mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 22:22:11 +02:00
Bug 414826 - Avoid NPE caused by null IValue
Change-Id: Ifef0b408c7572ae965de366b7037b6737622bdda Signed-off-by: Nathan Ridge <zeratul976@hotmail.com> Reviewed-on: https://git.eclipse.org/r/26782 Tested-by: Hudson CI Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
parent
438a42b367
commit
10f84fd94b
4 changed files with 7 additions and 4 deletions
|
@ -184,7 +184,7 @@ public class Value implements IValue {
|
|||
public static IValue unmarshal(ITypeMarshalBuffer buf) throws CoreException {
|
||||
short firstBytes= buf.getShort();
|
||||
if (firstBytes == TypeMarshalBuffer.NULL_TYPE)
|
||||
return null;
|
||||
return Value.UNKNOWN;
|
||||
if ((firstBytes & ITypeMarshalBuffer.FLAG1) != 0)
|
||||
return Value.UNKNOWN;
|
||||
if ((firstBytes & ITypeMarshalBuffer.FLAG2) != 0)
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
|||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.c.CVariableReadWriteFlags;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexCBindingConstants;
|
||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||
|
@ -105,7 +106,7 @@ class PDOMCVariable extends PDOMBinding implements IVariable {
|
|||
return getLinkage().loadValue(record + VALUE_OFFSET);
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
return null;
|
||||
return Value.UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||
|
@ -85,7 +86,7 @@ class PDOMCPPFieldSpecialization extends PDOMCPPSpecialization implements ICPPFi
|
|||
return getLinkage().loadValue(record + VALUE_OFFSET);
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
return null;
|
||||
return Value.UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IType;
|
|||
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVariableReadWriteFlags;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||
|
@ -110,7 +111,7 @@ class PDOMCPPVariable extends PDOMCPPBinding implements ICPPVariable {
|
|||
return getLinkage().loadValue(record + VALUE_OFFSET);
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
return null;
|
||||
return Value.UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue