am 4b73385e
: Merge "Prevent a NPE in ImapService search handling" into jb-ub-mail-ur10
* commit '4b73385ecbdae7857331a2a0b6f71c18ccd94b97': Prevent a NPE in ImapService search handling
This commit is contained in:
commit
e232140461
src/com/android/email
@ -5369,7 +5369,7 @@ public class EmailProvider extends ContentProvider {
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
// TODO: Handle searching for more...
|
||||
// This handles an initial search query. More results are loaded using uiFolderLoadMore.
|
||||
private Cursor uiSearch(Uri uri, String[] projection) {
|
||||
LogUtils.d(TAG, "runSearchQuery in search %s", uri);
|
||||
final long accountId = Long.parseLong(uri.getLastPathSegment());
|
||||
@ -5396,6 +5396,8 @@ public class EmailProvider extends ContentProvider {
|
||||
|
||||
final Context context = getContext();
|
||||
if (mSearchParams.mOffset == 0) {
|
||||
// TODO: This conditional is unnecessary, just two lines earlier we created
|
||||
// mSearchParams using a constructor that never sets mOffset.
|
||||
LogUtils.d(TAG, "deleting existing search results.");
|
||||
|
||||
// Delete existing contents of search mailbox
|
||||
|
@ -1443,10 +1443,13 @@ public class ImapService extends Service {
|
||||
sSearchResults.put(accountId, sortableMessages);
|
||||
}
|
||||
} else {
|
||||
// It seems odd for this to happen, but if the previous query returned zero results,
|
||||
// but the UI somehow still attempted to load more, then sSearchResults will have
|
||||
// a null value for this account. We need to handle this below.
|
||||
sortableMessages = sSearchResults.get(accountId);
|
||||
}
|
||||
|
||||
final int numSearchResults = sortableMessages.length;
|
||||
final int numSearchResults = (sortableMessages != null ? sortableMessages.length : 0);
|
||||
final int numToLoad =
|
||||
Math.min(numSearchResults - searchParams.mOffset, searchParams.mLimit);
|
||||
destMailbox.updateMessageCount(context, numSearchResults);
|
||||
|
Loading…
Reference in New Issue
Block a user