mirror of
https://github.com/revanced/smali.git
synced 2025-05-29 04:10:13 +02:00
Fix some null issues in the immutable implementation
This commit is contained in:
parent
db49fd7714
commit
dccca459e9
@ -70,7 +70,11 @@ public class ImmutableMethodImplementation implements MethodImplementation {
|
|||||||
this.debugItems = Objects.firstNonNull(debugItems, ImmutableList.<ImmutableDebugItem>of());
|
this.debugItems = Objects.firstNonNull(debugItems, ImmutableList.<ImmutableDebugItem>of());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ImmutableMethodImplementation of(MethodImplementation methodImplementation) {
|
@Nullable
|
||||||
|
public static ImmutableMethodImplementation of(@Nullable MethodImplementation methodImplementation) {
|
||||||
|
if (methodImplementation == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (methodImplementation instanceof ImmutableMethodImplementation) {
|
if (methodImplementation instanceof ImmutableMethodImplementation) {
|
||||||
return (ImmutableMethodImplementation)methodImplementation;
|
return (ImmutableMethodImplementation)methodImplementation;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ import org.jf.dexlib2.iface.value.*;
|
|||||||
import org.jf.util.ImmutableListConverter;
|
import org.jf.util.ImmutableListConverter;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ImmutableEncodedValue implements EncodedValue {
|
public class ImmutableEncodedValue implements EncodedValue {
|
||||||
@ -47,7 +48,11 @@ public class ImmutableEncodedValue implements EncodedValue {
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ImmutableEncodedValue of(EncodedValue encodedValue) {
|
@Nullable
|
||||||
|
public static ImmutableEncodedValue of(@Nullable EncodedValue encodedValue) {
|
||||||
|
if (encodedValue == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
switch (encodedValue.getValueType()) {
|
switch (encodedValue.getValueType()) {
|
||||||
case ValueType.BYTE:
|
case ValueType.BYTE:
|
||||||
return ImmutableByteEncodedValue.of((ByteEncodedValue)encodedValue);
|
return ImmutableByteEncodedValue.of((ByteEncodedValue)encodedValue);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user