summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Abdelrahman Daim <adaim@meta.com> 2024-11-13 14:42:05 -0800
committer Abdelrahman Daim <adaim@meta.com> 2024-11-18 10:28:31 +0000
commit5dc21225c57c74985b741b1565eabafb75cdd2f3 (patch)
tree25de641659282644ba01133002cba0afa2163877
parentf824197c243a9dc2f059c4cfbe8e9ac29e104c53 (diff)
Adding nullptr check for some framework components
Summary: Some framework components do not check whether the system service being called is null or not causing "FATAL EXCEPTION" in zygote system process. Adding nullptr or NULL obj check before calling. Test: m flash the device verify the zygote is running stable and not hitting FATAL EXECEPTION. Change-Id: Icd504fb529716ff0870d0d911b1cd8b356bf9bb7 Signed-off-by: Abdelrahman Daim <adaim@meta.com>
-rw-r--r--location/java/android/location/Geocoder.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/location/java/android/location/Geocoder.java b/location/java/android/location/Geocoder.java
index cdde7c66e268..9746dab4151c 100644
--- a/location/java/android/location/Geocoder.java
+++ b/location/java/android/location/Geocoder.java
@@ -83,8 +83,11 @@ public final class Geocoder {
* succeed.
*/
public static boolean isPresent() {
- ILocationManager lm = Objects.requireNonNull(ILocationManager.Stub.asInterface(
- ServiceManager.getService(Context.LOCATION_SERVICE)));
+ ILocationManager lm = ILocationManager.Stub.asInterface(
+ ServiceManager.getService(Context.LOCATION_SERVICE));
+ if (lm == null) {
+ return false;
+ }
try {
return lm.isGeocodeAvailable();
} catch (RemoteException e) {