forked from M66B/cm10-fxp-extended
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmms_cursor.patch
48 lines (46 loc) · 2.48 KB
/
mms_cursor.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
diff --git a/src/com/android/mms/data/WorkingMessage.java b/src/com/android/mms/data/WorkingMessage.java
index 14dd7b4..52eaffe 100755
--- a/src/com/android/mms/data/WorkingMessage.java
+++ b/src/com/android/mms/data/WorkingMessage.java
@@ -1473,6 +1473,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 fb135d5..2d2454c 100644
--- a/src/com/android/mms/ui/ComposeMessageActivity.java
+++ b/src/com/android/mms/ui/ComposeMessageActivity.java
@@ -4118,12 +4118,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) {
@@ -4171,7 +4173,7 @@ 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();
}