Fixed NPE in client library with State unparceling

This only fixes the symptom, but the crash log on Google Play doesn't shed light
on what the problem is.
This commit is contained in:
str4d
2014-10-17 06:54:26 +00:00
parent b633df73c0
commit dc27a782b0

View File

@ -35,7 +35,13 @@ public enum State implements Parcelable {
@Override
public State createFromParcel(final Parcel source) {
try {
return State.valueOf(source.readString());
String stateVal = source.readString();
if (stateVal == null) {
// Somehow we got a null from the Parcel. Fail gracefully.
android.util.Log.e("I2P", "Received null from State Parcel.");
return null;
}
return State.valueOf(stateVal);
} catch (IllegalArgumentException e) {
// Parcel is from a newer version of State with new states.
return null;