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

Commit a96c8b0b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Catch potential NPE in RingtoneFactory." into sc-dev am: 95cc14b9

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/services/Telecomm/+/14534499

Change-Id: If5c921cbf4ca9b66440bef65d45afec90b327972
parents 8681f6f5 95cc14b9
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -75,7 +75,12 @@ public class RingtoneFactory {

        if(ringtoneUri != null && userContext != null) {
            // Ringtone URI is explicitly specified. First, try to create a Ringtone with that.
            ringtone = RingtoneManager.getRingtone(userContext, ringtoneUri, volumeShaperConfig);
            try {
                ringtone = RingtoneManager.getRingtone(userContext, ringtoneUri,
                        volumeShaperConfig);
            } catch (NullPointerException npe) {
                Log.e(this, npe, "getRingtone: NPE while getting ringtone.");
            }
        }
        if(ringtone == null) {
            // Contact didn't specify ringtone or custom Ringtone creation failed. Get default
@@ -91,8 +96,12 @@ public class RingtoneFactory {
            if (defaultRingtoneUri == null) {
                return null;
            }
            try {
                ringtone = RingtoneManager.getRingtone(
                        contextToUse, defaultRingtoneUri, volumeShaperConfig);
            } catch (NullPointerException npe) {
                Log.e(this, npe, "getRingtone: NPE while getting ringtone.");
            }
        }
        if (ringtone != null) {
            ringtone.setAudioAttributes(new AudioAttributes.Builder()