mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-16 12:00:03 +03:00
Fix possible crash in autocompletion
https://github.com/SchildiChat/SchildiChat-android-rageshakes/issues/1129 Change-Id: If8514bdcd39e6477a938decf59d2380466898b23
This commit is contained in:
parent
6972f08b96
commit
1bc97e0aba
1 changed files with 8 additions and 1 deletions
|
@ -305,7 +305,14 @@ class AutoCompleter @AssistedInject constructor(
|
|||
endIndex = editable.length
|
||||
}
|
||||
*/
|
||||
val endIndex = editText.selectionEnd
|
||||
var endIndex = editText.selectionEnd
|
||||
if (endIndex == -1) {
|
||||
endIndex = editable.length
|
||||
} else if (endIndex < startIndex) {
|
||||
val tmp = startIndex
|
||||
startIndex = endIndex
|
||||
endIndex = tmp
|
||||
}
|
||||
|
||||
// Replace the word by its completion
|
||||
val displayName = matrixItem.getBestName()
|
||||
|
|
Loading…
Add table
Reference in a new issue