NPE fix for SyncStorageEngine read authority

Add a null check after an authority is read
from disk.

Bug: 26513719
Change-Id: I18f01828141110e776cc96f3b3be3d80125e70c1
This commit is contained in:
Shreyas Basarge
2016-02-18 11:56:05 +00:00
parent a5cafd2a93
commit a962d9eba7

View File

@@ -41,6 +41,7 @@ import android.util.Log;
import android.util.Pair;
import android.util.SparseArray;
import android.util.Xml;
import android.util.EventLog;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.ArrayUtils;
@@ -1746,8 +1747,13 @@ public class SyncStorageEngine extends Handler {
if ("authority".equals(tagName)) {
authority = parseAuthority(parser, version);
periodicSync = null;
if (authority.ident > highestAuthorityId) {
highestAuthorityId = authority.ident;
if (authority != null) {
if (authority.ident > highestAuthorityId) {
highestAuthorityId = authority.ident;
}
} else {
EventLog.writeEvent(0x534e4554, "26513719", -1,
"Malformed authority");
}
} else if (XML_TAG_LISTEN_FOR_TICKLES.equals(tagName)) {
parseListenForTickles(parser);