aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2019-05-04 16:07:40 +0200
committerChristian Schneppe <christian@pix-art.de>2019-05-04 16:07:40 +0200
commit6cf77e3a7ddead3c1a38dda8f522c2517ed9b37c (patch)
treeef43f63f196f9a1a5e3afd2e5dc3d0d8863c0575
parent2cdd612ff3fa32c4081d501122463d0fa57d75d6 (diff)
fixed rare NPE cause by race
-rw-r--r--src/main/java/de/pixart/messenger/ui/widget/EditMessage.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/widget/EditMessage.java b/src/main/java/de/pixart/messenger/ui/widget/EditMessage.java
index bb276a182..ca61491a9 100644
--- a/src/main/java/de/pixart/messenger/ui/widget/EditMessage.java
+++ b/src/main/java/de/pixart/messenger/ui/widget/EditMessage.java
@@ -85,16 +85,20 @@ public class EditMessage extends EmojiWrapperEditText {
}
private void triggerKeyboardEvents(final int length) {
+ final KeyboardListener listener = this.keyboardListener;
+ if (listener == null) {
+ return;
+ }
this.mTypingHandler.removeCallbacks(mTypingTimeout);
this.mTypingHandler.postDelayed(mTypingTimeout, Config.TYPING_TIMEOUT * 1000);
if (!isUserTyping && length > 0) {
this.isUserTyping = true;
- this.keyboardListener.onTypingStarted();
+ listener.onTypingStarted();
} else if (length == 0) {
this.isUserTyping = false;
- this.keyboardListener.onTextDeleted();
+ listener.onTextDeleted();
}
- this.keyboardListener.onTextChanged();
+ listener.onTextChanged();
}
public void setKeyboardListener(KeyboardListener listener) {