Check NetworkHandle against OutOfBound access am: 2a4d09e3e6

Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/qcom/sm8150/gps/+/11881949

Change-Id: I5f5d6cfa81ec46af11dc5f43c20cf4d7862aa69c
diff --git a/core/SystemStatus.h b/core/SystemStatus.h
index 8ec85fa..4d3a25e 100644
--- a/core/SystemStatus.h
+++ b/core/SystemStatus.h
@@ -551,6 +551,9 @@
                     typeCount--;
                 }
             }
+            if (MAX_NETWORK_HANDLES == lastValidIndex) {
+                --lastValidIndex;
+            }
 
             if (MAX_NETWORK_HANDLES != deletedIndex) {
                 LOC_LOGD("deletedIndex:%u, lastValidIndex:%u, typeCount:%u",