Skip to content

Commit

Permalink
Fix another possible crash in HeroContext relating superviews.
Browse files Browse the repository at this point in the history
  • Loading branch information
iDevid authored and JoeMatt committed Nov 17, 2019
1 parent b851483 commit b002ab1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Sources/HeroContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,12 @@ extension HeroContext {
hide(view: view)
}

if let pairedView = pairedView(for: view), let pairedSnapshot = snapshotViews[pairedView] {
let siblingViews = pairedView.superview!.subviews
let nextSiblings = siblingViews[siblingViews.index(of: pairedView)!+1..<siblingViews.count]
if
let pairedView = pairedView(for: view),
let pairedSnapshot = snapshotViews[pairedView],
let siblingViews = pairedView.superview?.subviews,
let index = siblingViews.index(of: pairedView) {
let nextSiblings = siblingViews[index+1..<siblingViews.count]
containerView.addSubview(pairedSnapshot)
containerView.addSubview(snapshot)
for subview in pairedView.subviews {
Expand Down

0 comments on commit b002ab1

Please sign in to comment.