Skip to content

Commit 15abb1c

Browse files
committed
Update Handler's removeCallbacks function
Handler's removeCallbacks function don't accept nullable runnable after API 28.
1 parent 46a82a3 commit 15abb1c

File tree

1 file changed

+3
-3
lines changed
  • aztec/src/main/kotlin/org/wordpress/aztec

1 file changed

+3
-3
lines changed

aztec/src/main/kotlin/org/wordpress/aztec/History.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ class History(val historyEnabled: Boolean, val historySize: Int) {
3333
}
3434

3535
fun beforeTextChanged(editText: EditText) {
36-
if (historyEnabled && !historyWorking) {
36+
if (historyRunnable != null && historyEnabled && !historyWorking) {
3737
mainHandler.removeCallbacks(historyRunnable)
3838
if (!textChangedPending) {
3939
textChangedPending = true
40-
historyRunnable?.text =
40+
historyRunnable.text =
4141
when (editText) {
4242
is AztecText -> editText.toFormattedHtml()
4343
is SourceViewEditText -> editText.text.toString()
4444
else -> ""
4545
}
46-
historyRunnable?.editText = editText
46+
historyRunnable.editText = editText
4747
}
4848
mainHandler.postDelayed(historyRunnable, historyThrottleTime)
4949
}

0 commit comments

Comments
 (0)