Protect against null fares
This commit is contained in:
parent
1c3816fc49
commit
62df6c476e
@ -197,15 +197,13 @@ public class RoutesListActivity extends AppCompatActivity implements TickSubscri
|
||||
lastUpdate.setTimeZone(PACIFIC_TIME);
|
||||
|
||||
// Update every day
|
||||
if (now.get(Calendar.DAY_OF_YEAR) != lastUpdate
|
||||
.get(Calendar.DAY_OF_YEAR)
|
||||
if (now.get(Calendar.DAY_OF_YEAR) != lastUpdate.get(Calendar.DAY_OF_YEAR)
|
||||
|| now.get(Calendar.YEAR) != lastUpdate.get(Calendar.YEAR)) {
|
||||
GetRouteFareTask fareTask = new GetRouteFareTask() {
|
||||
@Override
|
||||
public void onResult(String fare) {
|
||||
stationPair.setFare(fare);
|
||||
stationPair.setFareLastUpdated(System
|
||||
.currentTimeMillis());
|
||||
stationPair.setFareLastUpdated(System.currentTimeMillis());
|
||||
getListAdapter().notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,9 @@ public class FareContentHandler extends DefaultHandler {
|
||||
for (int i = attributes.getLength() - 1; i >= 0; i--) {
|
||||
attributeMap.put(attributes.getLocalName(i), attributes.getValue(i));
|
||||
}
|
||||
if (attributeMap.containsKey("class") && attributeMap.get("class").equals("cash")) {
|
||||
if (attributeMap.containsKey("class")
|
||||
&& attributeMap.get("class").equals("cash")
|
||||
&& attributeMap.get("amount") != null) {
|
||||
fare = "$" + attributeMap.get("amount");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user