-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
There is a subtle bug in this line:
[_scroller setNumberOfIncrements:fmax([self.content count]-1, 0)];
Namely, the count method returns an unsigned long (NSUInteger), and therefore when count is 0, and you subtract 1, you get an overflow. This can be fixed easily enough by casting to a signed integer:
[_scroller setNumberOfIncrements:fmax(((NSInteger)[self.content count])-1, 0)];
And yes, nine years on I am still using this code in Keyboard Maestro.
Metadata
Metadata
Assignees
Labels
No labels