mirror of
https://github.com/revanced/smali.git
synced 2025-05-02 15:44:30 +02:00
Fix issue with BuilderPackedSwitchPayload instructions
The transformation is performed lazily, and the keys were incorrect when iterating over the elements more than once
This commit is contained in:
parent
ec6246a09c
commit
a2bf7f64bc
@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
package org.jf.dexlib2.builder.instruction;
|
package org.jf.dexlib2.builder.instruction;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import org.jf.dexlib2.Format;
|
import org.jf.dexlib2.Format;
|
||||||
@ -55,13 +54,11 @@ public class BuilderPackedSwitchPayload extends BuilderSwitchPayload implements
|
|||||||
if (switchElements == null) {
|
if (switchElements == null) {
|
||||||
this.switchElements = ImmutableList.of();
|
this.switchElements = ImmutableList.of();
|
||||||
} else {
|
} else {
|
||||||
this.switchElements = Lists.transform(switchElements, new Function<Label, BuilderSwitchElement>() {
|
this.switchElements = Lists.newArrayList();
|
||||||
int key = startKey;
|
int key = startKey;
|
||||||
@Nullable @Override public BuilderSwitchElement apply(@Nullable Label target) {
|
for (Label target: switchElements) {
|
||||||
assert target != null;
|
this.switchElements.add(new BuilderSwitchElement(this, key++, target));
|
||||||
return new BuilderSwitchElement(BuilderPackedSwitchPayload.this, key++, target);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user