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

Commit f45c9464 authored by yinxu's avatar yinxu
Browse files

Check null before calling clone()

Bug: 67748005
Test: Basic telephony sanity

Change-Id: Ia46a82823b2d3c2bf3a6cb77a6fe191a7f7cb5d0
parent 37275780
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -143,7 +143,11 @@ public final class NetworkScanRequest implements Parcelable {
                    int incrementalResultsPeriodicity,
                    ArrayList<String> mccMncs) {
        this.mScanType = scanType;
        if (specifiers != null) {
            this.mSpecifiers = specifiers.clone();
        } else {
            this.mSpecifiers = null;
        }
        this.mSearchPeriodicity = searchPeriodicity;
        this.mMaxSearchTime = maxSearchTime;
        this.mIncrementalResults = incrementalResults;
@@ -187,7 +191,7 @@ public final class NetworkScanRequest implements Parcelable {

    /** Returns the radio access technologies with bands or channels that need to be scanned. */
    public RadioAccessSpecifier[] getSpecifiers() {
        return mSpecifiers.clone();
        return mSpecifiers == null ? null : mSpecifiers.clone();
    }

    /**
+12 −4
Original line number Diff line number Diff line
@@ -72,8 +72,16 @@ public final class RadioAccessSpecifier implements Parcelable {
    */
    public RadioAccessSpecifier(int ran, int[] bands, int[] channels) {
        this.mRadioAccessNetwork = ran;
        if (bands != null) {
            this.mBands = bands.clone();
        } else {
            this.mBands = null;
        }
        if (channels != null) {
            this.mChannels = channels.clone();
        } else {
            this.mChannels = null;
        }
    }

    /**
@@ -93,12 +101,12 @@ public final class RadioAccessSpecifier implements Parcelable {
     * it depends on the returned value of {@link #getRadioAccessNetwork()}.
     */
    public int[] getBands() {
        return mBands.clone();
        return mBands == null ? null : mBands.clone();
    }

    /** Returns the frequency channels that need to be scanned. */
    public int[] getChannels() {
        return mChannels.clone();
        return mChannels == null ? null : mChannels.clone();
    }

    public static final Parcelable.Creator<RadioAccessSpecifier> CREATOR =