Skip to content

Commit

Permalink
fix: Prevent Gutenberg connection logic from crashing Aztec
Browse files Browse the repository at this point in the history
A network connectivity subscriber was added to the post activity in: #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.
  • Loading branch information
dcalhoun committed Jan 26, 2024
1 parent b5f3cd2 commit a4bfd24
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}

Expand Down

0 comments on commit a4bfd24

Please sign in to comment.