diff --git a/Riot/Modules/Room/Attachements/MXKAttachmentsViewController.m b/Riot/Modules/Room/Attachements/MXKAttachmentsViewController.m index 3311213417..48bcc8085a 100644 --- a/Riot/Modules/Room/Attachements/MXKAttachmentsViewController.m +++ b/Riot/Modules/Room/Attachements/MXKAttachmentsViewController.m @@ -107,6 +107,8 @@ The attachments array (MXAttachment instances). @property (nonatomic) BOOL customAnimationsEnabled; +@property (nonatomic) BOOL isLoadingVideo; + @end @implementation MXKAttachmentsViewController @@ -969,8 +971,10 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPa navigationBarDisplayTimer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(hideNavigationBar) userInfo:self repeats:NO]; } } - else + else if (!self.isLoadingVideo) { + self.isLoadingVideo = YES; + MXKPieChartView *pieChartView = [[MXKPieChartView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)]; pieChartView.progress = 0; pieChartView.progressColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0.25]; @@ -1020,6 +1024,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPa [selectedCell.moviePlayer.player play]; [pieChartView removeFromSuperview]; + self.isLoadingVideo = NO; [self hideNavigationBar]; } @@ -1035,6 +1040,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPa MXLogDebug(@"[MXKAttachmentsVC] video download failed"); [pieChartView removeFromSuperview]; + self.isLoadingVideo = NO; // Display the navigation bar so that the user can leave this screen self.navigationBarContainer.hidden = NO; diff --git a/changelog.d/7791.bugfix b/changelog.d/7791.bugfix new file mode 100644 index 0000000000..9bd6b87db3 --- /dev/null +++ b/changelog.d/7791.bugfix @@ -0,0 +1 @@ +Fix a crash when the user taps play multiple times and the video download fails. \ No newline at end of file