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

Commit 06d11323 authored by Marvin W.'s avatar Marvin W. 🐿️
Browse files

Fix usage of null cell info

parent 29e1a0b1
Loading
Loading
Loading
Loading
+20 −12
Original line number Diff line number Diff line
@@ -53,9 +53,9 @@ import java.util.Set;
public class CellBackendHelper extends AbstractBackendHelper {
    private final Listener listener;
    private final TelephonyManager telephonyManager;
    private final Set<Cell> cells = new HashSet<>();
    private PhoneStateListener phoneStateListener;
    private boolean supportsCellInfoChanged = true;
    private Set<Cell> cells = new HashSet<>();

    /**
     * Create a new instance of {@link CellBackendHelper}. Call this in
@@ -259,19 +259,27 @@ public class CellBackendHelper extends AbstractBackendHelper {
    private synchronized boolean loadCells(List<CellInfo> cellInfo) {
        cells.clear();
        currentDataUsed = false;
        try {
            if (cellInfo != null) {
                fixAllCellInfo(cellInfo);
                for (CellInfo info : cellInfo) {
                    Cell cell = parseCellInfo(info);
                    if (cell == null) continue;
                    cells.add(cell);
                }
        for (NeighboringCellInfo info : telephonyManager.getNeighboringCellInfo()) {
            }
            List<NeighboringCellInfo> neighboringCellInfo = telephonyManager.getNeighboringCellInfo();
            if (neighboringCellInfo != null) {
                for (NeighboringCellInfo info : neighboringCellInfo) {
                    if (!hasCid(info.getCid())) {
                        Cell cell = parseCellInfo(info);
                        if (cell == null) continue;
                        cells.add(cell);
                    }
                }
            }
        } catch (Exception ignored) {
        }
        if (state == State.DISABLING)
            state = State.DISABLED;
        switch (state) {