Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1297 from maicki/FixRangeModeCrash
Browse files Browse the repository at this point in the history
[ASViewController] Fix crash accessing automaticallyAdjustRangeModeBasedOnViewEvents
  • Loading branch information
appleguy committed Mar 1, 2016
2 parents b6abb34 + def96ea commit 99e3f45
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions AsyncDisplayKit/ASViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
@implementation ASViewController
{
BOOL _ensureDisplayed;
BOOL _automaticallyAdjustRangeModeBasedOnViewEvents;
}

@synthesize automaticallyAdjustsScrollViewInsets = _automaticallyAdjustRangeModeBasedOnViewEvents;

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
ASDisplayNodeAssert(NO, @"ASViewController requires using -initWithNode:");
Expand Down Expand Up @@ -86,9 +85,19 @@ - (void)viewDidDisappear:(BOOL)animated

#pragma mark - Automatic range mode

- (BOOL)automaticallyAdjustRangeModeBasedOnViewEvents
{
return _automaticallyAdjustRangeModeBasedOnViewEvents;
}

- (void)setAutomaticallyAdjustRangeModeBasedOnViewEvents:(BOOL)automaticallyAdjustRangeModeBasedOnViewEvents
{
_automaticallyAdjustRangeModeBasedOnViewEvents = automaticallyAdjustRangeModeBasedOnViewEvents;
}

- (void)updateCurrentRangeModeWithModeIfPossible:(ASLayoutRangeMode)rangeMode
{
if (!self.automaticallyAdjustRangeModeBasedOnViewEvents) { return; }
if (!_automaticallyAdjustRangeModeBasedOnViewEvents) { return; }
if (![_node conformsToProtocol:@protocol(ASRangeControllerUpdateRangeProtocol)]) { return; }

id<ASRangeControllerUpdateRangeProtocol> updateRangeNode = (id<ASRangeControllerUpdateRangeProtocol>)_node;
Expand Down

0 comments on commit 99e3f45

Please sign in to comment.