From a4bfd24c959c09a033183d748e5f64928b921990 Mon Sep 17 00:00:00 2001 From: David Calhoun Date: Fri, 26 Jan 2024 12:09:35 -0500 Subject: [PATCH 1/2] fix: Prevent Gutenberg connection logic from crashing Aztec A network connectivity subscriber was added to the post activity in: https://github.com/wordpress-mobile/WordPress-Android/pull/19692 However, it was not scoped to only run in the Gutenberg editor. Because no guard was in place, the subscriber attempted to invoke a non-existent method on the Aztec editor, resulting in a crash. --- .../java/org/wordpress/android/ui/posts/EditPostActivity.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java index 8eb3b555a0c8..f37bd022b9ce 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java @@ -71,6 +71,7 @@ import org.wordpress.android.editor.EditorMediaUtils; import org.wordpress.android.editor.EditorThemeUpdateListener; import org.wordpress.android.editor.ExceptionLogger; +import org.wordpress.android.editor.gutenberg.GutenbergNetworkConnectionListener; import org.wordpress.android.editor.savedinstance.SavedInstanceDatabase; import org.wordpress.android.editor.gutenberg.DialogVisibility; import org.wordpress.android.editor.gutenberg.GutenbergEditorFragment; @@ -3844,6 +3845,8 @@ public void onEventMainThread(UploadService.UploadMediaRetryEvent event) { @Subscribe(threadMode = ThreadMode.MAIN) public void onEventMainThread(ConnectionChangeReceiver.ConnectionChangeEvent event) { + if (!(mEditorFragment instanceof GutenbergNetworkConnectionListener)) return; + ((GutenbergEditorFragment) mEditorFragment).onConnectionStatusChange(event.isConnected()); } From a931b5db32c1f583dc9a044ff4c3c4003c4f97e0 Mon Sep 17 00:00:00 2001 From: David Calhoun Date: Fri, 26 Jan 2024 12:20:35 -0500 Subject: [PATCH 2/2] docs: Add release note --- RELEASE-NOTES.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index bea44db9b619..a2152b86784b 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -3,6 +3,10 @@ 24.1 ----- +24.0.2 +----- +* [**] Fix Aztec editor crash when losing or gaining network connectivity [https://github.com/wordpress-mobile/WordPress-Android/pull/20053] + 24.0.1 ----- * [**] Fix crash when RichText values are not defined [https://github.com/wordpress-mobile/gutenberg-mobile/pull/6563]