Handle NPE, this should resolve the crash during modify Tabs

This commit is contained in:
Eric Liu 2015-02-03 01:02:45 +08:00
parent 3e383ce492
commit 22498415e6
1 changed files with 8 additions and 6 deletions

View File

@ -2656,12 +2656,14 @@ public final class Utils implements Constants, TwitterConstants {
try {
while (!cur.isAfterLast()) {
final String consumerSecret = cur.getString(indices.consumer_secret);
final byte[] consumerSecretBytes = consumerSecret.getBytes(Charset.forName("UTF-8"));
crc32.update(consumerSecretBytes, 0, consumerSecretBytes.length);
final long value = crc32.getValue();
crc32.reset();
for (final String keySecret : keySecrets) {
if (Long.parseLong(keySecret, 16) == value) return true;
if (consumerSecret != null) {
final byte[] consumerSecretBytes = consumerSecret.getBytes(Charset.forName("UTF-8"));
crc32.update(consumerSecretBytes, 0, consumerSecretBytes.length);
final long value = crc32.getValue();
crc32.reset();
for (final String keySecret : keySecrets) {
if (Long.parseLong(keySecret, 16) == value) return true;
}
}
cur.moveToNext();
}