mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Fix potential crash related to fullContext
This commit is contained in:
parent
b13e04d3f1
commit
a294d9c4ca
@ -686,11 +686,15 @@ public final class RichInputConnection implements PrivateCommandPerformer {
|
|||||||
NgramContext ngramContext = NgramContextUtils.getNgramContextFromNthPreviousWord(
|
NgramContext ngramContext = NgramContextUtils.getNgramContextFromNthPreviousWord(
|
||||||
prev, spacingAndPunctuations, n);
|
prev, spacingAndPunctuations, n);
|
||||||
|
|
||||||
ngramContext.fullContext = getTextBeforeCursor(4096, 0).toString();
|
CharSequence seq = getTextBeforeCursor(4096, 0);
|
||||||
|
if(seq != null) {
|
||||||
if(ngramContext.fullContext.length() == 4096) {
|
ngramContext.fullContext = seq.toString();
|
||||||
ngramContext.fullContext = String.join(" ",ngramContext.fullContext.split(" ")).substring(ngramContext.fullContext.split(" ")[0].length()+1);
|
|
||||||
|
|
||||||
|
if (ngramContext.fullContext.length() == 4096) {
|
||||||
|
ngramContext.fullContext = String.join(" ", ngramContext.fullContext.split(" ")).substring(ngramContext.fullContext.split(" ")[0].length() + 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ngramContext.fullContext = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return ngramContext;
|
return ngramContext;
|
||||||
|
Loading…
Reference in New Issue
Block a user