Skip to content

Commit

Permalink
Throw an exception when trying to set a scroller's knob proportion to…
Browse files Browse the repository at this point in the history
… NaN or Inifinity.
  • Loading branch information
aljungberg committed Feb 8, 2012
1 parent 8fdb872 commit c9d4089
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions AppKit/CPScroller.j
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "../Foundation/Foundation.h"

@import "CPControl.j"

// CPScroller Constants
Expand Down Expand Up @@ -260,6 +262,9 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark");
*/
- (void)setKnobProportion:(float)aProportion
{
if (!_IS_NUMERIC(aProportion))
[CPException raise:CPInvalidArgumentException reason:"aProportion must be numeric"];

_knobProportion = MIN(1.0, MAX(0.0001, aProportion));

[self setNeedsDisplay:YES];
Expand Down

0 comments on commit c9d4089

Please sign in to comment.