fix Uri.parse NPE in notifier

Closes #3241
// FREEBIE
This commit is contained in:
Jake McGinty 2015-05-22 14:07:54 -07:00 committed by Moxie Marlinspike
parent a3007c5906
commit fca98c42d5

View File

@ -76,6 +76,7 @@ import me.leolin.shortcutbadger.ShortcutBadger;
*/
public class MessageNotifier {
private static final String TAG = MessageNotifier.class.getSimpleName();
public static final int NOTIFICATION_ID = 1338;
@ -300,10 +301,18 @@ public class MessageNotifier {
String ringtone = TextSecurePreferences.getNotificationRingtone(context);
if (ringtone == null)
if (ringtone == null) {
Log.w(TAG, "ringtone preference was null.");
return;
}
Uri uri = Uri.parse(ringtone);
if (uri == null) {
Log.w(TAG, "couldn't parse ringtone uri " + ringtone);
return;
}
MediaPlayer player = new MediaPlayer();
player.setAudioStreamType(AudioManager.STREAM_NOTIFICATION);
player.setDataSource(context, uri);