Check for nulls

git-svn-id: https://smali.googlecode.com/svn/trunk@419 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com
2009-08-25 02:33:40 +00:00
parent 3c48a886bd
commit 97da4a7699

View File

@ -219,15 +219,19 @@ public class AnnotationDirectoryItem extends Item<AnnotationDirectoryItem> {
out.annotate(4, "class_annotations_off:");
}
out.annotate(4, "annotated_fields_size: 0x" + Integer.toHexString(fieldAnnotations.length) + " (" +
fieldAnnotations.length + ")");
out.annotate(4, "annotated_methods_size: 0x" + Integer.toHexString(methodAnnotations.length) + " (" +
methodAnnotations.length + ")");
out.annotate(4, "annotated_parameters_size: 0x" + Integer.toHexString(parameterAnnotations.length) + " (" +
parameterAnnotations.length + ")");
int length = fieldAnnotations==null?0:fieldAnnotations.length;
out.annotate(4, "annotated_fields_size: 0x" + Integer.toHexString(length) + " (" +
length + ")");
length = methodAnnotations==null?0:methodAnnotations.length;
out.annotate(4, "annotated_methods_size: 0x" + Integer.toHexString(length) + " (" +
length + ")");
length = parameterAnnotations==null?0:parameterAnnotations.length;
out.annotate(4, "annotated_parameters_size: 0x" + Integer.toHexString(length) + " (" +
length + ")");
int index = 0;
int index;
if (fieldAnnotations != null) {
index = 0;
for (int i=0; i<fieldAnnotations.length; i++) {
out.annotate(0, "[" + index++ + "] field_annotation");
@ -237,7 +241,9 @@ public class AnnotationDirectoryItem extends Item<AnnotationDirectoryItem> {
out.annotate(4, "annotations_off: 0x" + Integer.toHexString(fieldAnnotations[i].getOffset()));
out.deindent();
}
}
if (methodAnnotations != null) {
index = 0;
for (int i=0; i<methodAnnotations.length; i++) {
out.annotate(0, "[" + index++ + "] method_annotation");
@ -246,7 +252,9 @@ public class AnnotationDirectoryItem extends Item<AnnotationDirectoryItem> {
out.annotate(4, "annotations_off: 0x" + Integer.toHexString(methodAnnotations[i].getOffset()));
out.deindent();
}
}
if (parameterAnnotations != null) {
index = 0;
for (int i=0; i<parameterAnnotations.length; i++) {
out.annotate(0, "[" + index++ + "] parameter_annotation");
@ -255,6 +263,7 @@ public class AnnotationDirectoryItem extends Item<AnnotationDirectoryItem> {
out.annotate(4, "annotations_off: 0x" + Integer.toHexString(parameterAnnotations[i].getOffset()));
}
}
}
out.writeInt(classAnnotations==null?0:classAnnotations.getOffset());
out.writeInt(fieldAnnotations==null?0:fieldAnnotations.length);