Avoid crashes when owner account can't be retrieved (surely when shared pref is cleared).

This commit is contained in:
stom79 2018-09-03 08:20:02 +02:00
parent 6fb8bb1356
commit 8decfff818
1 changed files with 4 additions and 0 deletions

View File

@ -188,6 +188,10 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
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();
if( url.startsWith("/") ){
url = Helper.getLiveInstanceWithProtocol(getApplicationContext()) + account.getAvatar();