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
@ -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…
x
Reference in New Issue
Block a user