add toast when voting while no segments are present

This commit is contained in:
caneleex
2021-04-25 15:20:31 +02:00
parent ce87d8ac0e
commit 80697320ca
2 changed files with 4 additions and 1 deletions

View File

@ -374,8 +374,10 @@ public abstract class SponsorBlockUtils {
}
public static void onVotingClicked(final Context context) {
if (sponsorSegmentsOfCurrentVideo == null || sponsorSegmentsOfCurrentVideo.length == 0) // prevent crashing or empty dialog
if (sponsorSegmentsOfCurrentVideo == null || sponsorSegmentsOfCurrentVideo.length == 0) {
Toast.makeText(context.getApplicationContext(), str("vote_no_segments"), Toast.LENGTH_SHORT).show();
return;
}
CharSequence[] titles = new CharSequence[sponsorSegmentsOfCurrentVideo.length];
for (int i = 0; i < sponsorSegmentsOfCurrentVideo.length; i++) {
SponsorSegment segment = sponsorSegmentsOfCurrentVideo[i];