mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-22 16:07:30 +00:00
Fix for NPE during a secure session with no sender identity key.
This commit is contained in:
parent
3900808578
commit
5fb7ae7ecf
@ -16,14 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.thoughtcrime.securesms.database;
|
package org.thoughtcrime.securesms.database;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.crypto.IdentityKey;
|
|
||||||
import org.thoughtcrime.securesms.crypto.InvalidKeyException;
|
|
||||||
import org.thoughtcrime.securesms.crypto.MasterCipher;
|
|
||||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
|
||||||
import org.thoughtcrime.securesms.util.Base64;
|
|
||||||
|
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
@ -32,6 +24,14 @@ import android.database.sqlite.SQLiteOpenHelper;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.crypto.IdentityKey;
|
||||||
|
import org.thoughtcrime.securesms.crypto.InvalidKeyException;
|
||||||
|
import org.thoughtcrime.securesms.crypto.MasterCipher;
|
||||||
|
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||||
|
import org.thoughtcrime.securesms.util.Base64;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public class IdentityDatabase extends Database {
|
public class IdentityDatabase extends Database {
|
||||||
|
|
||||||
private static final Uri CHANGE_URI = Uri.parse("content://textsecure/identities");
|
private static final Uri CHANGE_URI = Uri.parse("content://textsecure/identities");
|
||||||
@ -61,6 +61,9 @@ public class IdentityDatabase extends Database {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getNameForIdentity(MasterSecret masterSecret, IdentityKey identityKey) {
|
public String getNameForIdentity(MasterSecret masterSecret, IdentityKey identityKey) {
|
||||||
|
if (identityKey == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
MasterCipher masterCipher = new MasterCipher(masterSecret);
|
MasterCipher masterCipher = new MasterCipher(masterSecret);
|
||||||
SQLiteDatabase database = databaseHelper.getReadableDatabase();
|
SQLiteDatabase database = databaseHelper.getReadableDatabase();
|
||||||
Cursor cursor = null;
|
Cursor cursor = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user