Avoid crashes when owner account can't be retrieved (surely when shared pref is cleared).
This commit is contained in:
parent
6fb8bb1356
commit
8decfff818
|
@ -188,6 +188,10 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
|
||||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
Account account = new AccountDAO(getApplicationContext(),db).getAccountByID(userId);
|
Account account = new AccountDAO(getApplicationContext(),db).getAccountByID(userId);
|
||||||
|
if( account.getAvatar() == null){
|
||||||
|
Toast.makeText(ShowConversationActivity.this,R.string.toast_error, Toast.LENGTH_LONG).show();
|
||||||
|
finish();
|
||||||
|
}
|
||||||
String url = account.getAvatar();
|
String url = account.getAvatar();
|
||||||
if( url.startsWith("/") ){
|
if( url.startsWith("/") ){
|
||||||
url = Helper.getLiveInstanceWithProtocol(getApplicationContext()) + account.getAvatar();
|
url = Helper.getLiveInstanceWithProtocol(getApplicationContext()) + account.getAvatar();
|
||||||
|
|
Loading…
Reference in New Issue