add try/catch to avoid fatal crashes

This commit is contained in:
Samuel Newman
2025-11-10 13:29:58 +02:00
parent 187efaf359
commit 8ce301cc56
+5
View File
@@ -57,6 +57,7 @@ import {
import {sanitizeDisplayName} from '#/lib/strings/display-names' import {sanitizeDisplayName} from '#/lib/strings/display-names'
import {cleanError} from '#/lib/strings/errors' import {cleanError} from '#/lib/strings/errors'
import {sanitizeHandle} from '#/lib/strings/handles' import {sanitizeHandle} from '#/lib/strings/handles'
import {logger} from '#/logger'
import {isAndroid} from '#/platform/detection' import {isAndroid} from '#/platform/detection'
import {useA11y} from '#/state/a11y' import {useA11y} from '#/state/a11y'
import { import {
@@ -1057,11 +1058,15 @@ function PlayPauseTapArea({
// gets called after a timeout, so guard against being called after unmount -sfn // gets called after a timeout, so guard against being called after unmount -sfn
if (!player || !isMounted.current) return if (!player || !isMounted.current) return
doubleTapRef.current = null doubleTapRef.current = null
try {
if (player.playing) { if (player.playing) {
player.pause() player.pause()
} else { } else {
player.play() player.play()
} }
} catch (err) {
logger.error('Could not toggle play/pause', {safeMessage: err})
}
}) })
const onPress = () => { const onPress = () => {