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

[ASViewController] Fix crash accessing automaticallyAdjustRangeModeBasedOnViewEvents #1297

Merged
merged 1 commit into from
Mar 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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