Skip to content

Commit

Permalink
Merge pull request #177 from saran2020/patch-1
Browse files Browse the repository at this point in the history
Fix cursor.close() not getting called for empty cursor
  • Loading branch information
klinker24 authored Sep 11, 2020
2 parents 5b530a8 + 3a50d40 commit f6fa7d3
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,10 @@ private void sendSmsMessage(String text, String[] addresses, long threadId, int
Log.v("send_transaction", "inserted to uri: " + messageUri);

Cursor query = context.getContentResolver().query(messageUri, new String[] {"_id"}, null, null, null);
if (query != null && query.moveToFirst()) {
messageId = query.getInt(0);
if (query != null) {
if (query.moveToFirst()) {
messageId = query.getInt(0);
}
query.close();
}

Expand Down

0 comments on commit f6fa7d3

Please sign in to comment.