aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/sun
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-11-06 15:59:15 +0100
committerSven Gothel <[email protected]>2010-11-06 15:59:15 +0100
commitce6eb7b462a44b4c8aa0f8d7501d9ecd6b9a3481 (patch)
treef85d777c546b6034c5c34d99ae8a1eee5d371853 /src/java/com/sun
parent4c808ec572808a221d0ce08785dad2d18f77ea5f (diff)
Avoid NPE
Diffstat (limited to 'src/java/com/sun')
-rw-r--r--src/java/com/sun/gluegen/cgram/types/CompoundType.java4
-rw-r--r--src/java/com/sun/gluegen/cgram/types/EnumType.java8
-rw-r--r--src/java/com/sun/gluegen/cgram/types/FunctionType.java8
3 files changed, 15 insertions, 5 deletions
diff --git a/src/java/com/sun/gluegen/cgram/types/CompoundType.java b/src/java/com/sun/gluegen/cgram/types/CompoundType.java
index 51efad5..0a880de 100644
--- a/src/java/com/sun/gluegen/cgram/types/CompoundType.java
+++ b/src/java/com/sun/gluegen/cgram/types/CompoundType.java
@@ -69,7 +69,9 @@ public class CompoundType extends Type implements Cloneable {
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;
}
diff --git a/src/java/com/sun/gluegen/cgram/types/EnumType.java b/src/java/com/sun/gluegen/cgram/types/EnumType.java
index c6f8541..49f962d 100644
--- a/src/java/com/sun/gluegen/cgram/types/EnumType.java
+++ b/src/java/com/sun/gluegen/cgram/types/EnumType.java
@@ -87,8 +87,12 @@ public class EnumType extends IntType implements Cloneable {
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;
}
diff --git a/src/java/com/sun/gluegen/cgram/types/FunctionType.java b/src/java/com/sun/gluegen/cgram/types/FunctionType.java
index 35b62b7..3b09d8b 100644
--- a/src/java/com/sun/gluegen/cgram/types/FunctionType.java
+++ b/src/java/com/sun/gluegen/cgram/types/FunctionType.java
@@ -56,8 +56,12 @@ public class FunctionType extends Type implements Cloneable {
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;
}