Skip to content

Commit

Permalink
add a null check to default ringtone uri
Browse files Browse the repository at this point in the history
  • Loading branch information
tibbi committed Dec 18, 2016
1 parent a1ed419 commit 0d37b0f
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Config(val context: Context) {
set(vibrate) = mPrefs.edit().putBoolean(VIBRATE, vibrate).apply()

var reminderSound: String
get() = mPrefs.getString(REMINDER_SOUND, RingtoneManager.getActualDefaultRingtoneUri(context, RingtoneManager.TYPE_NOTIFICATION).toString())
get() = mPrefs.getString(REMINDER_SOUND, getDefaultNotificationSound())
set(path) = mPrefs.edit().putString(REMINDER_SOUND, path).apply()

var storedView: Int
Expand All @@ -64,4 +64,6 @@ class Config(val context: Context) {
defaultReminderType = REMINDER_AT_START
mPrefs.edit().putInt(REMINDER_MINUTES, mins).apply()
}

fun getDefaultNotificationSound() = RingtoneManager.getActualDefaultRingtoneUri(context, RingtoneManager.TYPE_NOTIFICATION)?.toString() ?: ""
}

0 comments on commit 0d37b0f

Please sign in to comment.