mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 08:20:32 +05:30
fix: crash when trying to vote while there are no sb segments yet
This commit is contained in:
parent
563af5ecca
commit
a5d41b7802
@ -6,6 +6,7 @@ import android.os.Bundle
|
|||||||
import android.text.format.DateUtils
|
import android.text.format.DateUtils
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.widget.ArrayAdapter
|
import android.widget.ArrayAdapter
|
||||||
|
import android.widget.Toast
|
||||||
import androidx.fragment.app.DialogFragment
|
import androidx.fragment.app.DialogFragment
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import com.github.libretube.R
|
import com.github.libretube.R
|
||||||
@ -92,6 +93,12 @@ class VoteForSegmentDialog : DialogFragment() {
|
|||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
val binding = _binding ?: return@withContext
|
val binding = _binding ?: return@withContext
|
||||||
|
|
||||||
|
if (segments.isEmpty()) {
|
||||||
|
dismiss()
|
||||||
|
Toast.makeText(context, R.string.no_segments_found, Toast.LENGTH_SHORT).show()
|
||||||
|
return@withContext
|
||||||
|
}
|
||||||
|
|
||||||
val segmentTexts = segments.map {
|
val segmentTexts = segments.map {
|
||||||
"${it.category} (${
|
"${it.category} (${
|
||||||
DateUtils.formatElapsedTime(it.segmentStartAndEnd.first.toLong())
|
DateUtils.formatElapsedTime(it.segmentStartAndEnd.first.toLong())
|
||||||
|
@ -494,6 +494,7 @@
|
|||||||
<string name="remember_playback_speed">Remember playback speed</string>
|
<string name="remember_playback_speed">Remember playback speed</string>
|
||||||
<string name="successfully_removed_from_playlist">Successfully removed \"%1$s\" from the playlist.</string>
|
<string name="successfully_removed_from_playlist">Successfully removed \"%1$s\" from the playlist.</string>
|
||||||
<string name="watched">Watched</string>
|
<string name="watched">Watched</string>
|
||||||
|
<string name="no_segments_found">There are no segments for this video yet.</string>
|
||||||
|
|
||||||
<!-- Notification channel strings -->
|
<!-- Notification channel strings -->
|
||||||
<string name="download_channel_name">Download Service</string>
|
<string name="download_channel_name">Download Service</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user