AssertionError when sending all-whitespace message
- Android version: 7.1.2
- Phone model: Hisense A2M
- Briar version: 1.1.8 (6b022afa)
- User feedback: "Send nothing (a space)"
Stacktrace:
java.lang.AssertionError
at org.briarproject.briar.android.conversation.ConversationActivity.onSendClick(ConversationActivity.java:712)
at org.briarproject.briar.android.view.TextSendController.onSendEvent(TextSendController.java:49)
at org.briarproject.briar.android.view.TextSendController.lambda$new$0$TextSendController(TextSendController.java:34)
at org.briarproject.briar.android.view.-$$Lambda$TextSendController$10Be2Hyuh5TqgqEmcNIq7rn_c-c.onClick(lambda)
at android.view.View.performClick(View.java:5644)
at android.view.View$PerformClick.run(View.java:22440)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6166)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
I can reproduce this by sending an all-whitespace message. We trim the text in EmojiTextInputView#getText(), but we call TextInputListener#onTextIsEmptyChanged() when the untrimmed text becomes empty/non-empty. This causes the send button to be enabled when all-whitespace text is entered, but then ConversationActivity#onSendClick() asserts that it can only be called if the text (now trimmed) is non-empty or the attachments list is non-empty.