Merge "Check null before calling clone()"
This commit is contained in:
@@ -143,7 +143,11 @@ public final class NetworkScanRequest implements Parcelable {
|
|||||||
int incrementalResultsPeriodicity,
|
int incrementalResultsPeriodicity,
|
||||||
ArrayList<String> mccMncs) {
|
ArrayList<String> mccMncs) {
|
||||||
this.mScanType = scanType;
|
this.mScanType = scanType;
|
||||||
this.mSpecifiers = specifiers.clone();
|
if (specifiers != null) {
|
||||||
|
this.mSpecifiers = specifiers.clone();
|
||||||
|
} else {
|
||||||
|
this.mSpecifiers = null;
|
||||||
|
}
|
||||||
this.mSearchPeriodicity = searchPeriodicity;
|
this.mSearchPeriodicity = searchPeriodicity;
|
||||||
this.mMaxSearchTime = maxSearchTime;
|
this.mMaxSearchTime = maxSearchTime;
|
||||||
this.mIncrementalResults = incrementalResults;
|
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. */
|
/** Returns the radio access technologies with bands or channels that need to be scanned. */
|
||||||
public RadioAccessSpecifier[] getSpecifiers() {
|
public RadioAccessSpecifier[] getSpecifiers() {
|
||||||
return mSpecifiers.clone();
|
return mSpecifiers == null ? null : mSpecifiers.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -72,8 +72,16 @@ public final class RadioAccessSpecifier implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public RadioAccessSpecifier(int ran, int[] bands, int[] channels) {
|
public RadioAccessSpecifier(int ran, int[] bands, int[] channels) {
|
||||||
this.mRadioAccessNetwork = ran;
|
this.mRadioAccessNetwork = ran;
|
||||||
this.mBands = bands.clone();
|
if (bands != null) {
|
||||||
this.mChannels = channels.clone();
|
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()}.
|
* it depends on the returned value of {@link #getRadioAccessNetwork()}.
|
||||||
*/
|
*/
|
||||||
public int[] getBands() {
|
public int[] getBands() {
|
||||||
return mBands.clone();
|
return mBands == null ? null : mBands.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the frequency channels that need to be scanned. */
|
/** Returns the frequency channels that need to be scanned. */
|
||||||
public int[] getChannels() {
|
public int[] getChannels() {
|
||||||
return mChannels.clone();
|
return mChannels == null ? null : mChannels.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Parcelable.Creator<RadioAccessSpecifier> CREATOR =
|
public static final Parcelable.Creator<RadioAccessSpecifier> CREATOR =
|
||||||
|
|||||||
Reference in New Issue
Block a user