Fix a bug when creating a dex file that has a blank section for one of the indexed item types

git-svn-id: https://smali.googlecode.com/svn/trunk@452 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com
2009-09-09 06:58:50 +00:00
parent a6bf1ed0fe
commit 61eedba1ab
2 changed files with 4 additions and 4 deletions

View File

@ -497,7 +497,7 @@ public class DexFile
int sectionCount = 0;
for (Section section: sectionsByType) {
if (section != null && (section.ItemType.isIndexedItem() || section.getItems().size() > 0)) {
if (section != null && section.getItems().size() > 0) {
sectionCount++;
}
}
@ -505,7 +505,7 @@ public class DexFile
Section[] sections = new Section[sectionCount];
sectionCount = 0;
for (Section section: sectionsByType) {
if (section != null && (section.ItemType.isIndexedItem() || section.getItems().size() > 0)) {
if (section != null && section.getItems().size() > 0) {
sections[sectionCount++] = section;
}
}

View File

@ -52,7 +52,7 @@ public abstract class Section<T extends Item> {
/**
* The offset of this section within the <code>DexFile</code>
*/
protected int offset = -1;
protected int offset = 0;
/**
* The type of item that this section holds
@ -93,7 +93,7 @@ public abstract class Section<T extends Item> {
offset = item.placeAt(offset, i);
}
} else {
this.offset = -1;
this.offset = 0;
}
return offset;