Fix crash when receiving call with no corresponding identity key.

This commit is contained in:
Cody Henthorne
2021-02-17 10:26:45 -05:00
committed by GitHub
parent a1457d22d6
commit 214cb25d1b
5 changed files with 31 additions and 10 deletions

View File

@@ -4,6 +4,7 @@ import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.ArrayList;
import java.util.Arrays;
@@ -59,4 +60,23 @@ public class ParcelUtil {
public static boolean readBoolean(@NonNull Parcel in) {
return in.readByte() != 0;
}
public static void writeByteArray(@NonNull Parcel dest, @Nullable byte[] data) {
if (data == null) {
dest.writeInt(-1);
} else {
dest.writeInt(data.length);
dest.writeByteArray(data);
}
}
public static @Nullable byte[] readByteArray(@NonNull Parcel in) {
int length = in.readInt();
if (length == -1) {
return null;
}
byte[] data = new byte[length];
in.readByteArray(data);
return data;
}
}