adding some crashfixes

This commit is contained in:
tibbi 2021-04-19 16:09:15 +02:00
parent b7fdedb939
commit 68d06c828a
2 changed files with 10 additions and 3 deletions

View File

@ -29,7 +29,10 @@ import com.simplemobiletools.clock.receivers.HideAlarmReceiver
import com.simplemobiletools.clock.receivers.HideTimerReceiver
import com.simplemobiletools.clock.services.SnoozeService
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.helpers.DAY_MINUTES
import com.simplemobiletools.commons.helpers.SILENT
import com.simplemobiletools.commons.helpers.isMarshmallowPlus
import com.simplemobiletools.commons.helpers.isOreoPlus
import java.util.*
import kotlin.math.pow
@ -241,7 +244,11 @@ fun Context.showAlarmNotification(alarm: Alarm) {
val pendingIntent = getOpenAlarmTabIntent()
val notification = getAlarmNotification(pendingIntent, alarm)
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.notify(alarm.id, notification)
try {
notificationManager.notify(alarm.id, notification)
} catch (e: Exception) {
showErrorToast(e)
}
if (alarm.days > 0) {
scheduleNextAlarm(alarm, false)

View File

@ -117,7 +117,7 @@ class ClockFragment : Fragment() {
}
private fun updateTimeZones() {
val selectedTimeZones = requireContext().config.selectedTimeZones
val selectedTimeZones = context?.config?.selectedTimeZones ?: return
view.time_zones_list.beVisibleIf(selectedTimeZones.isNotEmpty())
if (selectedTimeZones.isEmpty()) {
return