diff options
author | Marcel Bokhorst <marcel@bokhorst.biz> | 2013-05-04 14:04:46 +0200 |
---|---|---|
committer | Michael Bestas <mikeioannina@gmail.com> | 2013-06-17 22:17:19 +0300 |
commit | 2b46e3ce287e8f31e61e504075d27dc77767896c (patch) | |
tree | 9143edbb176ef9a5753dd5a67fc34c2165a14736 | |
parent | 28591279b34ceb43076f349a2e0aafaf2840b453 (diff) | |
download | packages_apps_Mms-2b46e3ce287e8f31e61e504075d27dc77767896c.zip packages_apps_Mms-2b46e3ce287e8f31e61e504075d27dc77767896c.tar.gz packages_apps_Mms-2b46e3ce287e8f31e61e504075d27dc77767896c.tar.bz2 |
Prevent FC in low memory conditions
Add missing null cursor checks
Signed-off-by: Michael Bestas <mikeioannina@gmail.com>
Change-Id: I974eea82cac3dfe3a01e5d79c1721d3514f940f6
-rwxr-xr-x | src/com/android/mms/data/WorkingMessage.java | 3 | ||||
-rw-r--r-- | src/com/android/mms/ui/ComposeMessageActivity.java | 19 |
2 files changed, 14 insertions, 8 deletions
diff --git a/src/com/android/mms/data/WorkingMessage.java b/src/com/android/mms/data/WorkingMessage.java index 250a63a..a9459f1 100755 --- a/src/com/android/mms/data/WorkingMessage.java +++ b/src/com/android/mms/data/WorkingMessage.java @@ -1519,6 +1519,9 @@ public class WorkingMessage { cursor = SqliteWrapper.query(context, cr, Mms.Draft.CONTENT_URI, MMS_DRAFT_PROJECTION, selection, null, null); + if (cursor == null) { + return null; + } Uri uri; try { diff --git a/src/com/android/mms/ui/ComposeMessageActivity.java b/src/com/android/mms/ui/ComposeMessageActivity.java index 901c227..48b5487 100644 --- a/src/com/android/mms/ui/ComposeMessageActivity.java +++ b/src/com/android/mms/ui/ComposeMessageActivity.java @@ -4235,12 +4235,14 @@ public class ComposeMessageActivity extends Activity int newSelectionPos = -1; long targetMsgId = getIntent().getLongExtra("select_id", -1); if (targetMsgId != -1) { - cursor.moveToPosition(-1); - while (cursor.moveToNext()) { - long msgId = cursor.getLong(COLUMN_ID); - if (msgId == targetMsgId) { - newSelectionPos = cursor.getPosition(); - break; + if (cursor != null) { + cursor.moveToPosition(-1); + while (cursor.moveToNext()) { + long msgId = cursor.getLong(COLUMN_ID); + if (msgId == targetMsgId) { + newSelectionPos = cursor.getPosition(); + break; + } } } } else if (mSavedScrollPosition != -1) { @@ -4272,7 +4274,7 @@ public class ComposeMessageActivity extends Activity } else { int count = mMsgListAdapter.getCount(); long lastMsgId = 0; - if (count > 0) { + if (cursor != null && count > 0) { cursor.moveToLast(); lastMsgId = cursor.getLong(COLUMN_ID); } @@ -4296,7 +4298,8 @@ public class ComposeMessageActivity extends Activity // mSentMessage is true). // Show the recipients editor to give the user a chance to add // more people before the conversation begins. - if (cursor.getCount() == 0 && !isRecipientsEditorVisible() && !mSentMessage) { + if (cursor != null && cursor.getCount() == 0 + && !isRecipientsEditorVisible() && !mSentMessage) { initRecipientsEditor(); } |