summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2018-11-18 10:39:43 +0100
committerDamiano Galassi <[email protected]>2018-11-18 10:39:43 +0100
commit3339b9f6ac0fe00ee5f086ac7335433badeb1c0a (patch)
treeff7e176b187e5eb60cf394b258a81d9e0218bfab /macosx
parentf185a82e72948bb8afcdf30ed72bd73b7d0bd688 (diff)
MacGui: fix an exception in the preview window touchbar.
Diffstat (limited to 'macosx')
-rw-r--r--macosx/HBPictureHUDController.m18
1 files changed, 12 insertions, 6 deletions
diff --git a/macosx/HBPictureHUDController.m b/macosx/HBPictureHUDController.m
index bcd17f613..9cc0fe591 100644
--- a/macosx/HBPictureHUDController.m
+++ b/macosx/HBPictureHUDController.m
@@ -72,12 +72,15 @@
_generator = generator;
NSUInteger imagesCount = generator.imagesCount;
- self.slider.numberOfTickMarks = imagesCount;
- self.slider.maxValue = imagesCount - 1;
-
- if (self.selectedIndex > imagesCount)
+ if (imagesCount > 0)
{
- self.selectedIndex = imagesCount - 1;
+ self.slider.numberOfTickMarks = imagesCount;
+ self.slider.maxValue = imagesCount - 1;
+
+ if (self.selectedIndex > imagesCount)
+ {
+ self.selectedIndex = imagesCount - 1;
+ }
}
if (@available(macOS 10.12.2, *))
@@ -319,7 +322,10 @@ static NSTouchBarItemIdentifier HBTouchBarFitToScreen = @"fr.handbrake.fitToScre
{
NSScrubber *scrubber = (NSScrubber *)[[self.touchBar itemForIdentifier:HBTouchBarScrubber] view];
[scrubber reloadData];
- scrubber.animator.selectedIndex = self.selectedIndex;
+ if (self.selectedIndex < scrubber.numberOfItems)
+ {
+ scrubber.animator.selectedIndex = self.selectedIndex;
+ }
}
- (void)_touchBar_updateScrubberSelectedIndex:(NSUInteger)selectedIndex