Skip to content

Commit

Permalink
Fix usage of null cell info
Browse files Browse the repository at this point in the history
  • Loading branch information
mar-v-in committed Feb 18, 2015
1 parent 29e1a0b commit 06d1132
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions src/org/microg/nlp/api/CellBackendHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
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
Expand Down Expand Up @@ -259,18 +259,26 @@ private boolean hasCid(long cid) {
private synchronized boolean loadCells(List<CellInfo> cellInfo) {
cells.clear();
currentDataUsed = false;
fixAllCellInfo(cellInfo);
for (CellInfo info : cellInfo) {
Cell cell = parseCellInfo(info);
if (cell == null) continue;
cells.add(cell);
}
for (NeighboringCellInfo info : telephonyManager.getNeighboringCellInfo()) {
if (!hasCid(info.getCid())) {
Cell cell = parseCellInfo(info);
if (cell == null) continue;
cells.add(cell);
try {
if (cellInfo != null) {
fixAllCellInfo(cellInfo);
for (CellInfo info : cellInfo) {
Cell cell = parseCellInfo(info);
if (cell == null) continue;
cells.add(cell);
}
}
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;
Expand Down

0 comments on commit 06d1132

Please sign in to comment.