1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-24 08:38:51 -05:00

Removed unnecessary null pointer checks

This commit is contained in:
cketti 2011-01-19 01:30:13 +00:00
parent 4e11c17ff5
commit 22834d6998
8 changed files with 13 additions and 35 deletions

View File

@ -558,10 +558,7 @@ public class FolderList extends K9ListActivity
}
localFolder = account.getLocalStore().getFolder(folderName);
localFolder.open(Folder.OpenMode.READ_WRITE);
if (localFolder != null)
{
localFolder.clearAllMessages();
}
localFolder.clearAllMessages();
}
catch (Exception e)
{
@ -1093,14 +1090,11 @@ public class FolderList extends K9ListActivity
}
localFolder = account.getLocalStore().getFolder(folderName);
int unreadMessageCount = localFolder.getUnreadMessageCount();
if (localFolder != null)
FolderInfoHolder folderHolder = getFolder(folderName);
if (folderHolder != null)
{
FolderInfoHolder folderHolder = getFolder(folderName);
if (folderHolder != null)
{
folderHolder.populate(context, localFolder, mAccount, unreadMessageCount);
mHandler.dataChanged();
}
folderHolder.populate(context, localFolder, mAccount, unreadMessageCount);
mHandler.dataChanged();
}
}
}

View File

@ -478,7 +478,7 @@ public class MessagingController implements Runnable
Folder[] folderArray = localFolders.toArray(EMPTY_FOLDER_ARRAY);
if (refreshRemote || localFolders == null || localFolders.size() == 0)
if (refreshRemote || localFolders.size() == 0)
{
doRefreshRemote(account, listener);
return;

View File

@ -97,7 +97,7 @@ public class ImapResponseParser
* See RFC 3501, Section 9 Formal Syntax (resp-text)
*/
}
response.mCompleted = (token == null);
response.mCompleted = true;
}
/**
@ -639,7 +639,8 @@ public class ImapResponseParser
}
else
{
return o1 == o2;
// Both o1 and o2 are null
return true;
}
}

View File

@ -3146,10 +3146,6 @@ public class ImapStore extends Store
idling.set(true);
doneSent.set(false);
if (conn == null)
{
throw new MessagingException("No connection available for idling");
}
conn.setReadTimeout((getAccount().getIdleRefreshMinutes() * 60 * 1000) + IDLE_READ_TIMEOUT_INCREMENT);
untaggedResponses = executeSimpleCommand(COMMAND_IDLE, false, ImapFolderPusher.this);
idling.set(false);

View File

@ -2456,10 +2456,7 @@ public class WebDavStore extends Store
}
}
if (envelope != null)
{
envelopes.put(uid, envelope);
}
envelopes.put(uid, envelope);
}
return envelopes;

View File

@ -314,10 +314,7 @@ public class Storage implements SharedPreferences
workingStorage.remove();
workingChangedKeys.remove();
mDb.endTransaction();
if (mDb != null)
{
mDb.close();
}
mDb.close();
}
}

View File

@ -77,10 +77,7 @@ public class BootReceiver extends CoreReceiver
Log.i(K9.LOG_TAG, "BootReceiver Got alarm to fire alarmedIntent " + alarmedAction);
alarmedIntent.putExtra(WAKE_LOCK_ID, tmpWakeLockId);
tmpWakeLockId = null;
if (alarmedIntent != null)
{
context.startService(alarmedIntent);
}
context.startService(alarmedIntent);
}
else if (SCHEDULE_INTENT.equals(action))
{

View File

@ -96,12 +96,8 @@ public abstract class CoreService extends Service
}
finally
{
if (wakeLock != null)
{
wakeLock.release();
}
wakeLock.release();
}
}
public void execute(Context context, final Runnable runner, int wakeLockTime, final Integer startId)