Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 339d69ae authored by yinxu's avatar yinxu
Browse files

Check whether the bands and channels are null

We need to first check whether bands and channels are null before
doing anything else on them.

Cherry-picked cleanly from:
https://android-review.googlesource.com/#/c/422286/

Test: Telephony sanity tests
Bug: 30954762

Merged-in: Idaa3ebeabe37248d9de05f8397fecc4dc9938d66
Change-Id: Idaa3ebeabe37248d9de05f8397fecc4dc9938d66
(cherry picked from commit c771233f)
parent 706cbe16
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -104,6 +104,9 @@ public final class NetworkScanRequestTracker {
    }

    private boolean isValidScan(NetworkScanRequestInfo nsri) {
        if (nsri.mRequest.specifiers == null) {
            return false;
        }
        if (nsri.mRequest.specifiers.length > NetworkScanRequest.MAX_RADIO_ACCESS_NETWORKS) {
            return false;
        }
@@ -112,8 +115,10 @@ public final class NetworkScanRequestTracker {
                    && ras.radioAccessNetwork != EUTRAN) {
                return false;
            }
            if (ras.bands.length > NetworkScanRequest.MAX_BANDS
                    || ras.channels.length > NetworkScanRequest.MAX_CHANNELS) {
            if (ras.bands != null && ras.bands.length > NetworkScanRequest.MAX_BANDS) {
                return false;
            }
            if (ras.channels != null && ras.channels.length > NetworkScanRequest.MAX_CHANNELS) {
                return false;
            }
        }
+8 −4
Original line number Diff line number Diff line
@@ -1846,12 +1846,16 @@ public final class RIL extends BaseCommands implements CommandsInterface {
                                    + " not supported!");
                            return;
                    }
                    if (ras.bands != null) {
                        for (int band : ras.bands) {
                            bands.add(band);
                        }
                    }
                    if (ras.channels != null) {
                        for (int channel : ras.channels) {
                            s.channels.add(channel);
                        }
                    }
                    request.specifiers.add(s);
                }