am 5139c4fd: am 702a736e: am 31838876: am 9baaa4b5: am 6ad437ed: Merge "Fix NPE due to the lack of null-check" into lmp-dev
* commit '5139c4fd28d1a34981d590f2fbec9b407481ea52': Fix NPE due to the lack of null-checkmain
commit
7b673c7265
|
@ -84,8 +84,8 @@ public final class CursorAnchorInfoCompatWrapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
@UsedForTesting
|
||||||
public static boolean isAvailable() {
|
public boolean isAvailable() {
|
||||||
return sCursorAnchorInfoClass.exists();
|
return sCursorAnchorInfoClass.exists() && mInstance != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object mInstance;
|
private Object mInstance;
|
||||||
|
@ -96,7 +96,7 @@ public final class CursorAnchorInfoCompatWrapper {
|
||||||
|
|
||||||
@UsedForTesting
|
@UsedForTesting
|
||||||
public static CursorAnchorInfoCompatWrapper fromObject(final Object instance) {
|
public static CursorAnchorInfoCompatWrapper fromObject(final Object instance) {
|
||||||
if (!isAvailable()) {
|
if (!sCursorAnchorInfoClass.exists()) {
|
||||||
return new CursorAnchorInfoCompatWrapper(null);
|
return new CursorAnchorInfoCompatWrapper(null);
|
||||||
}
|
}
|
||||||
return new CursorAnchorInfoCompatWrapper(instance);
|
return new CursorAnchorInfoCompatWrapper(instance);
|
||||||
|
|
|
@ -182,7 +182,7 @@ public class TextDecorator {
|
||||||
private void layoutMain() {
|
private void layoutMain() {
|
||||||
final CursorAnchorInfoCompatWrapper info = mCursorAnchorInfoWrapper;
|
final CursorAnchorInfoCompatWrapper info = mCursorAnchorInfoWrapper;
|
||||||
|
|
||||||
if (info == null) {
|
if (info == null || !info.isAvailable()) {
|
||||||
cancelLayoutInternalExpectedly("CursorAnchorInfo isn't available.");
|
cancelLayoutInternalExpectedly("CursorAnchorInfo isn't available.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue