ui: do not crash w/large playlists
This commit is contained in:
@@ -24,6 +24,7 @@ import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.graphics.PointF
|
||||
import android.os.Build
|
||||
import android.os.TransactionTooLargeException
|
||||
import android.view.View
|
||||
import android.view.WindowInsets
|
||||
import androidx.annotation.RequiresApi
|
||||
@@ -300,7 +301,15 @@ fun Context.share(songs: Collection<Song>) {
|
||||
mimeTypes.add(song.format.mimeType)
|
||||
}
|
||||
|
||||
builder.setType(mimeTypes.singleOrNull() ?: "audio/*").startChooser()
|
||||
try {
|
||||
builder.setType(mimeTypes.singleOrNull() ?: "audio/*").startChooser()
|
||||
} catch (e: TransactionTooLargeException) {
|
||||
L.e("Failed to share ${songs.size} songs: Too large")
|
||||
showToast(R.string.err_share_too_large)
|
||||
} catch (e: Exception) {
|
||||
L.e("Failed to share ${songs.size} songs: $e")
|
||||
showToast(R.string.err_share_failed)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user