mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
am 6ad437ed
: Merge "Fix NPE due to the lack of null-check" into lmp-dev
* commit '6ad437edd93382ce872c42fc8a2126e34dbf98d9': Fix NPE due to the lack of null-check
This commit is contained in:
commit
9baaa4b5c7
@ -84,8 +84,8 @@ public final class CursorAnchorInfoCompatWrapper {
|
||||
}
|
||||
|
||||
@UsedForTesting
|
||||
public static boolean isAvailable() {
|
||||
return sCursorAnchorInfoClass.exists();
|
||||
public boolean isAvailable() {
|
||||
return sCursorAnchorInfoClass.exists() && mInstance != null;
|
||||
}
|
||||
|
||||
private Object mInstance;
|
||||
@ -96,7 +96,7 @@ public final class CursorAnchorInfoCompatWrapper {
|
||||
|
||||
@UsedForTesting
|
||||
public static CursorAnchorInfoCompatWrapper fromObject(final Object instance) {
|
||||
if (!isAvailable()) {
|
||||
if (!sCursorAnchorInfoClass.exists()) {
|
||||
return new CursorAnchorInfoCompatWrapper(null);
|
||||
}
|
||||
return new CursorAnchorInfoCompatWrapper(instance);
|
||||
|
@ -182,7 +182,7 @@ public class TextDecorator {
|
||||
private void layoutMain() {
|
||||
final CursorAnchorInfoCompatWrapper info = mCursorAnchorInfoWrapper;
|
||||
|
||||
if (info == null) {
|
||||
if (info == null || !info.isAvailable()) {
|
||||
cancelLayoutInternalExpectedly("CursorAnchorInfo isn't available.");
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user