diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 571f4408074a..f3813d9449aa 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -1,6 +1,7 @@ 15.2 ---- * [**] Block editor: Display content metrics information (blocks, words, characters count). +* [*] Fixed a crash that results in navigating to the block editor quickly after logging out and immediately back in. * [***] Reader content improved: a lot of fixes in how the content appears when you're reading a post. ----- diff --git a/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController.swift b/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController.swift index 675dfa237679..efad01a7f478 100644 --- a/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController.swift +++ b/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController.swift @@ -349,14 +349,14 @@ class GutenbergViewController: UIViewController, PostEditor { private var previousFirstResponder: UIView? private func setupKeyboardObservers() { - keyboardShowObserver = NotificationCenter.default.addObserver(forName: UIResponder.keyboardDidShowNotification, object: nil, queue: .main) { (notification) in - if let keyboardRect = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect { + keyboardShowObserver = NotificationCenter.default.addObserver(forName: UIResponder.keyboardDidShowNotification, object: nil, queue: .main) { [weak self] (notification) in + if let self = self, let keyboardRect = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect { self.keyboardFrame = keyboardRect self.updateConstraintsToAvoidKeyboard(frame: keyboardRect) } } - keyboardHideObserver = NotificationCenter.default.addObserver(forName: UIResponder.keyboardDidShowNotification, object: nil, queue: .main) { (notification) in - if let keyboardRect = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect { + keyboardHideObserver = NotificationCenter.default.addObserver(forName: UIResponder.keyboardDidShowNotification, object: nil, queue: .main) { [weak self] (notification) in + if let self = self, let keyboardRect = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect { self.keyboardFrame = keyboardRect self.updateConstraintsToAvoidKeyboard(frame: keyboardRect) }