Fix bug in GnssLocationProvider.

Perform nullptr checking correctly before calling setCallback()
on gnssXtraIface.

Bug: 33334137
Test: Checked no crash happens when GNSS HAL returns a null
GnssXtraInfc.

Change-Id: I763d96443a0a6c0f036ecfc86ac442b297560efa
(cherry picked from commit e8650320c55869b8ab7430be5aabca3f0c77fe38)
diff --git a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
index b0a4297..7db6d42 100644
--- a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
+++ b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
@@ -1009,12 +1009,12 @@
     sp<IGnssXtraCallback> gnssXtraCbIface = new GnssXtraCallback();
     if (gnssXtraIface == nullptr) {
         ALOGE("Unable to initialize GNSS Xtra interface\n");
-    }
-
-    result = gnssXtraIface->setCallback(gnssXtraCbIface);
-    if ((!result) || (!result.getStatus().isOk())) {
-        gnssXtraIface = nullptr;
-        ALOGE("SetCallback for Gnss Xtra Interface fails\n");
+    } else {
+        result = gnssXtraIface->setCallback(gnssXtraCbIface);
+        if ((!result) || (!result.getStatus().isOk())) {
+            gnssXtraIface = nullptr;
+            ALOGE("SetCallback for Gnss Xtra Interface fails\n");
+        }
     }
 
     sp<IAGnssCallback> aGnssCbIface = new AGnssCallback();