Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 37a3528f authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Do not throw NPE if GRUU uri is not populated

Instead of GRUU URI parsing cause NPE if the string is empty,
check to make sure the string is populated before trying to parse.

Test: atest CtsTelephonyTestCases
Change-Id: I194ed8cc0e7df359ff9cf826e233f29e80ad71ff
parent c2c84d16
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.PersistableBundle;
import android.text.TextUtils;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -561,7 +562,12 @@ public final class SipDelegateImsConfiguration implements Parcelable {
        builder.setSipCniHeader(getString(KEY_SIP_CONFIG_CELLULAR_NETWORK_INFO_HEADER_STRING));
        builder.setSipAssociatedUriHeader(getString(KEY_SIP_CONFIG_P_ASSOCIATED_URI_HEADER_STRING));
        if (getBoolean(KEY_SIP_CONFIG_IS_GRUU_ENABLED_BOOL, false)) {
            builder.setPublicGruuUri(Uri.parse(getString(KEY_SIP_CONFIG_UE_PUBLIC_GRUU_STRING)));
            String uri = getString(KEY_SIP_CONFIG_UE_PUBLIC_GRUU_STRING);
            Uri gruuUri = null;
            if (!TextUtils.isEmpty(uri)) {
                gruuUri = Uri.parse(uri);
            }
            builder.setPublicGruuUri(gruuUri);
        }
        if (getBoolean(KEY_SIP_CONFIG_IS_IPSEC_ENABLED_BOOL, false)) {
            builder.setIpSecConfiguration(new SipDelegateConfiguration.IpSecConfiguration(