Commit 6edd175b authored by Miklos Magyari's avatar Miklos Magyari
Browse files

fixed possible null reference exceptions


Signed-off-by: Miklos Magyari's avatarMiklos Magyari <miklos.magyari@sigmatechnology.se>
parent e8e28532
...@@ -118,6 +118,7 @@ public final class ClassTypeBody extends TTCN3Scope implements IReferenceChainEl ...@@ -118,6 +118,7 @@ public final class ClassTypeBody extends TTCN3Scope implements IReferenceChainEl
} }
public void addDefinition(Definition def) { public void addDefinition(Definition def) {
def.setInherited(false);
definitions.add(def); definitions.add(def);
def.setFullNameParent(this); def.setFullNameParent(this);
def.setMyScope(this); def.setMyScope(this);
......
...@@ -264,9 +264,11 @@ public final class CompFieldMap extends ASTNode implements ILocateableNode, IInc ...@@ -264,9 +264,11 @@ public final class CompFieldMap extends ASTNode implements ILocateableNode, IInc
lastCompilationTimeStamp = timestamp; lastCompilationTimeStamp = timestamp;
for (final CompField field : fields) { for (final CompField field : fields) {
final Type fieldType = field.getType(); final Type fieldType = field.getType();
fieldType.setGenName(parentType.getGenNameOwn(), field.getIdentifier().getName()); if (fieldType != null) {
fieldType.setParentType(parentType); fieldType.setGenName(parentType.getGenNameOwn(), field.getIdentifier().getName());
field.check(timestamp); fieldType.setParentType(parentType);
field.check(timestamp);
}
} }
} }
......
...@@ -510,9 +510,10 @@ public final class TTCN3_Choice_Type extends TTCN3_Set_Seq_Choice_BaseType { ...@@ -510,9 +510,10 @@ public final class TTCN3_Choice_Type extends TTCN3_Set_Seq_Choice_BaseType {
refChain.add(this); refChain.add(this);
refChain.markState(); refChain.markState();
for (int i = 0; i < getNofComponents(); i++) { for (int i = 0; i < getNofComponents(); i++) {
final CompField cf = getComponentByIndex(i); final Type cftype = getComponentByIndex(i).getType();
if (cftype != null) {
cf.getType().checkCodingAttributes(timestamp, refChain); cftype.checkCodingAttributes(timestamp, refChain);
}
} }
refChain.previousState(); refChain.previousState();
} }
...@@ -574,7 +575,9 @@ public final class TTCN3_Choice_Type extends TTCN3_Set_Seq_Choice_BaseType { ...@@ -574,7 +575,9 @@ public final class TTCN3_Choice_Type extends TTCN3_Set_Seq_Choice_BaseType {
for (int i = 0; i < getNofComponents(); i++) { for (int i = 0; i < getNofComponents(); i++) {
final Type fieldType = getComponentByIndex(i).getType(); final Type fieldType = getComponentByIndex(i).getType();
fieldType.forceJson(timestamp); if (fieldType != null) {
fieldType.forceJson(timestamp);
}
} }
if (jsonAttribute == null) { if (jsonAttribute == null) {
......
...@@ -385,7 +385,9 @@ public abstract class TTCN3_Set_Seq_Choice_BaseType extends Type implements ITyp ...@@ -385,7 +385,9 @@ public abstract class TTCN3_Set_Seq_Choice_BaseType extends Type implements ITyp
} }
for (int i = 0, size = getNofComponents(); i < size; i++) { for (int i = 0, size = getNofComponents(); i < size; i++) {
final IType type = getComponentByIndex(i).getType(); final IType type = getComponentByIndex(i).getType();
type.getTypesWithNoCodingTable(timestamp, typeList, onlyOwnTable); if (type != null) {
type.getTypesWithNoCodingTable(timestamp, typeList, onlyOwnTable);
}
} }
} }
...@@ -637,6 +639,9 @@ public abstract class TTCN3_Set_Seq_Choice_BaseType extends Type implements ITyp ...@@ -637,6 +639,9 @@ public abstract class TTCN3_Set_Seq_Choice_BaseType extends Type implements ITyp
for ( final CompField compField : compFieldMap.fields ) { for ( final CompField compField : compFieldMap.fields ) {
final Type fieldType = compField.getType(); final Type fieldType = compField.getType();
if (fieldType == null) {
return false;
}
final IType refdLast = fieldType.getTypeRefdLast(timestamp); final IType refdLast = fieldType.getTypeRefdLast(timestamp);
if (!refdLast.canHaveCoding(timestamp, coding)) { if (!refdLast.canHaveCoding(timestamp, coding)) {
insideCanHaveCoding = false; insideCanHaveCoding = false;
...@@ -1634,7 +1639,10 @@ public abstract class TTCN3_Set_Seq_Choice_BaseType extends Type implements ITyp ...@@ -1634,7 +1639,10 @@ public abstract class TTCN3_Set_Seq_Choice_BaseType extends Type implements ITyp
codersToGenerate.add(encodingType); codersToGenerate.add(encodingType);
for ( final CompField compField : compFieldMap.fields ) { for ( final CompField compField : compFieldMap.fields ) {
compField.getType().getTypeRefdLast(timestamp).setGenerateCoderFunctions(timestamp, encodingType); final Type cftype = compField.getType();
if (cftype != null) {
cftype.getTypeRefdLast(timestamp).setGenerateCoderFunctions(timestamp, encodingType);
}
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment