wordpress-mobile / WordPress-Editor-Android

⛔️ [DEPRECATED] A reusable Android rich text editor component.
GNU General Public License v2.0
188 stars 50 forks source link

getContent returns empty string when fragment isn't added #460

Closed nbradbury closed 7 years ago

nbradbury commented 7 years ago

While trying to reproduce a nasty bug where the editor content is lost, I came across this code in the editor.

@Override
public CharSequence getContent() {
    if (!isAdded()) {
        return "";
    }
...

That looks suspiciously like the cause of the problem. I suspect that somehow getContent() is being called when the editor fragment isn't attached, resulting in empty content when the fragment is re-created.

More details on this bug can be found here.