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
1 changed files with 4 additions and 0 deletions

View File

@ -425,6 +425,10 @@ public class NotificationService {
} }
final Uri uri = Uri.parse(ringtonePreference); final Uri uri = Uri.parse(ringtonePreference);
this.currentlyPlayingRingtone = RingtoneManager.getRingtone(mXmppConnectionService, uri); 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) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
this.currentlyPlayingRingtone.setLooping(true); this.currentlyPlayingRingtone.setLooping(true);
} }