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

Commit d09d44ec authored by David Su's avatar David Su
Browse files

WifiScanner: check nullness of bundle extra

In WifiScanner#getAvailableChannels(), check if the
extra is null and return an empty list if that is the
case to ensure that the API upholds its @NonNull
guarantee.

Bug: 143985829
Test: compiles
Change-Id: I5abc2e6362469f77db0fa386adbe06b445aa799c
parent ddea4daf
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -138,7 +138,8 @@ public class WifiScanner {
    public List<Integer> getAvailableChannels(@WifiBand int band) {
        try {
            Bundle bundle = mService.getAvailableChannels(band, mContext.getOpPackageName());
            return bundle.getIntegerArrayList(GET_AVAILABLE_CHANNELS_EXTRA);
            List<Integer> channels = bundle.getIntegerArrayList(GET_AVAILABLE_CHANNELS_EXTRA);
            return channels == null ? new ArrayList<>() : channels;
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }