fixed rare NPE cause by race
This commit is contained in:
parent
3d208e6e34
commit
818f2ab61c
|
@ -87,16 +87,20 @@ public class EditMessage extends EmojiWrapperEditText {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void triggerKeyboardEvents(final int length) {
|
private void triggerKeyboardEvents(final int length) {
|
||||||
|
final KeyboardListener listener = this.keyboardListener;
|
||||||
|
if (listener == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.mTypingHandler.removeCallbacks(mTypingTimeout);
|
this.mTypingHandler.removeCallbacks(mTypingTimeout);
|
||||||
this.mTypingHandler.postDelayed(mTypingTimeout, Config.TYPING_TIMEOUT * 1000);
|
this.mTypingHandler.postDelayed(mTypingTimeout, Config.TYPING_TIMEOUT * 1000);
|
||||||
if (!isUserTyping && length > 0) {
|
if (!isUserTyping && length > 0) {
|
||||||
this.isUserTyping = true;
|
this.isUserTyping = true;
|
||||||
this.keyboardListener.onTypingStarted();
|
listener.onTypingStarted();
|
||||||
} else if (length == 0) {
|
} else if (length == 0) {
|
||||||
this.isUserTyping = false;
|
this.isUserTyping = false;
|
||||||
this.keyboardListener.onTextDeleted();
|
listener.onTextDeleted();
|
||||||
}
|
}
|
||||||
this.keyboardListener.onTextChanged();
|
listener.onTextChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKeyboardListener(KeyboardListener listener) {
|
public void setKeyboardListener(KeyboardListener listener) {
|
||||||
|
|
Loading…
Reference in a new issue