Skip to content

Commit

Permalink
Fix crash when mergeOptions were called before stack view was created (
Browse files Browse the repository at this point in the history
…wix#5945)

Co-authored-by: Yogev Ben David <yogevbd@wix.com>
  • Loading branch information
2 people authored and jinshin1013 committed Feb 24, 2020
1 parent c835bbf commit e18dea4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void onAttachToParent() {

@Override
public void mergeOptions(Options options) {
presenter.mergeOptions(options, this, getCurrentChild());
if (isViewShown()) presenter.mergeOptions(options, this, getCurrentChild());
super.mergeOptions(options);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,12 @@ public void mergeChildOptions_updatesViewWithNewOptions() {
verify(uut, times(1)).mergeChildOptions(optionsToMerge, vc);
}

@Test
public void mergeOptions_doesNotMergeOptionsIfViewIsNotVisible() {
uut.mergeOptions(Options.EMPTY);
verify(presenter, times(0)).mergeOptions(any(), any(), any());
}

@Test
public void mergeChildOptions_updatesParentControllerWithNewOptions() {
StackController uut = TestUtils.newStackController(activity)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,4 @@
}
}
}
}
}

0 comments on commit e18dea4

Please sign in to comment.