Clear 'potential null pointer access' warnings.

This commit is contained in:
Andreas Schildbach 2015-02-05 16:28:59 +01:00
parent 5f8fc199a4
commit 4c8f48931c
2 changed files with 9 additions and 4 deletions

View file

@ -17,6 +17,8 @@
package de.schildbach.pte;
import static com.google.common.base.Preconditions.checkState;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
@ -2869,6 +2871,9 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
}
}
checkState(departure != null);
checkState(arrival != null);
XmlPullUtil.skipExit(pp, "ps");
final boolean isRealtime = XmlPullUtil.valueTag(pp, "realtime").equals("1");

View file

@ -1201,10 +1201,10 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
XmlPullUtil.skipExit(pp, "Arrival");
// remove last intermediate
final int size = intermediateStops != null ? intermediateStops.size() : 0;
if (size >= 1)
if (!intermediateStops.get(size - 1).location.id.equals(sectionArrivalLocation.id))
intermediateStops.remove(size - 1);
if (intermediateStops != null)
if (!intermediateStops.isEmpty())
if (!intermediateStops.get(intermediateStops.size() - 1).location.id.equals(sectionArrivalLocation.id))
intermediateStops.remove(intermediateStops.size() - 1);
XmlPullUtil.skipExit(pp, "ConSection");