Skip to content

Commit

Permalink
Fix "multiple unsequenced modifications to 'currentFrame'" warning in…
Browse files Browse the repository at this point in the history
… Xcode 12 beta 2.
  • Loading branch information
MaddTheSane committed Jul 10, 2020
1 parent 8d6b1cf commit 49f98d3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Classes/Session/TSSTPageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,16 @@ - (void)animateImage:(NSTimer *)timer
return;
}

NSBitmapImageRep * testImageRep = (NSBitmapImageRep *)[pageImage bestRepresentationForRect: NSZeroRect context: [NSGraphicsContext currentContext] hints: nil];;
NSBitmapImageRep * testImageRep = (NSBitmapImageRep *)[pageImage bestRepresentationForRect: NSZeroRect context: [NSGraphicsContext currentContext] hints: nil];
NSInteger loopCount = [[animationInfo valueForKey: @"loopCount"] integerValue];
NSInteger frameCount = ([[testImageRep valueForProperty: NSImageFrameCount] integerValue] - 1);
NSInteger currentFrame = [[testImageRep valueForProperty: NSImageCurrentFrame] integerValue];

currentFrame = currentFrame < frameCount ? ++currentFrame : 0;
if (currentFrame < frameCount) {
currentFrame++;
} else {
currentFrame = 0;
}
if(currentFrame == 0 && loopCount > 1)
{
--loopCount;
Expand Down

0 comments on commit 49f98d3

Please sign in to comment.