Skip to content

Commit

Permalink
Avoid NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
sgothel committed Nov 6, 2010
1 parent 4c808ec commit ce6eb7b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/java/com/sun/gluegen/cgram/types/CompoundType.java
Expand Up @@ -69,7 +69,9 @@ private CompoundType(String name, SizeThunk size, CompoundTypeKind kind, int cvA

public Object clone() {
CompoundType n = (CompoundType) super.clone();
n.fields = (ArrayList) this.fields.clone();
if(null!=this.fields) {
n.fields = (ArrayList) this.fields.clone();
}
return n;
}

Expand Down
8 changes: 6 additions & 2 deletions src/java/com/sun/gluegen/cgram/types/EnumType.java
Expand Up @@ -87,8 +87,12 @@ protected EnumType(String name, IntType underlyingType, int cvAttributes) {

public Object clone() {
EnumType n = (EnumType) super.clone();
n.underlyingType = (IntType) this.underlyingType.clone();
n.enums = (ArrayList) this.enums.clone();
if(null!=this.underlyingType) {
n.underlyingType = (IntType) this.underlyingType.clone();
}
if(null!=this.enums) {
n.enums = (ArrayList) this.enums.clone();
}
return n;
}

Expand Down
8 changes: 6 additions & 2 deletions src/java/com/sun/gluegen/cgram/types/FunctionType.java
Expand Up @@ -56,8 +56,12 @@ public FunctionType(String name, SizeThunk size, Type returnType, int cvAttribut

public Object clone() {
FunctionType n = (FunctionType) super.clone();
n.argumentTypes = (ArrayList) this.argumentTypes.clone();
n.argumentNames = (ArrayList) this.argumentNames.clone();
if(null!=this.argumentTypes) {
n.argumentTypes = (ArrayList) this.argumentTypes.clone();
}
if(null!=this.argumentNames) {
n.argumentNames = (ArrayList) this.argumentNames.clone();
}
return n;
}

Expand Down

0 comments on commit ce6eb7b

Please sign in to comment.