Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
13927401
Commit
13927401
authored
4 months ago
by
Aleksandras Kostarevas
Browse files
Options
Downloads
Patches
Plain Diff
Fix NPE when text from IC is null
parent
51ca6d55
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java/src/org/futo/inputmethod/latin/RichInputConnection.java
+4
-3
4 additions, 3 deletions
java/src/org/futo/inputmethod/latin/RichInputConnection.java
with
4 additions
and
3 deletions
java/src/org/futo/inputmethod/latin/RichInputConnection.java
+
4
−
3
View file @
13927401
...
...
@@ -424,6 +424,7 @@ public final class RichInputConnection implements PrivateCommandPerformer {
return
Constants
.
NOT_A_CODE
;
}
@Nullable
public
CharSequence
getTextBeforeCursor
(
final
int
n
,
final
int
flags
)
{
final
int
cachedLength
=
mCommittedTextBeforeComposingText
.
length
()
+
mComposingText
.
length
();
...
...
@@ -991,7 +992,7 @@ public final class RichInputConnection implements PrivateCommandPerformer {
public
int
getCodePointAfterCursor
()
{
// TODO: only does char at the moment
final
CharSequence
s
=
getTextAfterCursor
(
1
,
0
);
if
(
s
.
length
()
<=
0
)
return
Constants
.
NOT_A_CODE
;
if
(
s
==
null
||
s
.
length
()
<=
0
)
return
Constants
.
NOT_A_CODE
;
return
s
.
charAt
(
0
);
}
...
...
@@ -1007,7 +1008,7 @@ public final class RichInputConnection implements PrivateCommandPerformer {
*/
public
boolean
spacePrecedesCursor
()
{
final
CharSequence
s
=
getTextBeforeCursor
(
1
,
0
);
if
(
s
.
length
()
<=
0
)
return
false
;
if
(
s
==
null
||
s
.
length
()
<=
0
)
return
false
;
return
s
.
charAt
(
0
)
==
Constants
.
CODE_SPACE
;
}
...
...
@@ -1016,7 +1017,7 @@ public final class RichInputConnection implements PrivateCommandPerformer {
*/
public
boolean
digitPrecedesCursor
()
{
final
CharSequence
s
=
getTextBeforeCursor
(
1
,
0
);
if
(
s
.
length
()
<=
0
)
return
false
;
if
(
s
==
null
||
s
.
length
()
<=
0
)
return
false
;
return
Character
.
isDigit
(
s
.
charAt
(
0
));
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment