do not attempt to play ringtone if none was found

This commit is contained in:
Daniel Gultsch 2021-04-08 10:53:01 +02:00
parent 9fc04c4b1e
commit 37ce311764

View file

@ -425,6 +425,10 @@ public class NotificationService {
}
final Uri uri = Uri.parse(ringtonePreference);
this.currentlyPlayingRingtone = RingtoneManager.getRingtone(mXmppConnectionService, uri);
if (this.currentlyPlayingRingtone == null) {
Log.d(Config.LOGTAG,"unable to find ringtone for uri "+uri);
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
this.currentlyPlayingRingtone.setLooping(true);
}