Add a null check for mDefaultQos in DataCallResponse.writeToParcel()

java.lang.NullPointerException:
Attempt to invoke virtual method 'int android.telephony.data.Qos.getType()'
on a null object reference

Bug: 173667436
Test: Basic data and Iwlan/VoLTE handover test.
Change-Id: I6045ac9fa4e757eea74389002d0d443d20459d46
This commit is contained in:
Hsiaoan Hsu
2020-11-19 19:34:51 +08:00
parent 00bca78ece
commit 905b674e40

View File

@@ -487,10 +487,14 @@ public final class DataCallResponse implements Parcelable {
dest.writeInt(mMtuV6);
dest.writeInt(mHandoverFailureMode);
dest.writeInt(mPduSessionId);
if (mDefaultQos.getType() == Qos.QOS_TYPE_EPS) {
dest.writeParcelable((EpsQos)mDefaultQos, flags);
if (mDefaultQos != null) {
if (mDefaultQos.getType() == Qos.QOS_TYPE_EPS) {
dest.writeParcelable((EpsQos) mDefaultQos, flags);
} else {
dest.writeParcelable((NrQos) mDefaultQos, flags);
}
} else {
dest.writeParcelable((NrQos)mDefaultQos, flags);
dest.writeParcelable(null, flags);
}
dest.writeList(mQosSessions);
}