Fixes potential crashes

This commit is contained in:
tom79 2017-09-11 07:01:59 +02:00
parent d46652f069
commit 90564d9b2d
2 changed files with 3 additions and 2 deletions

View File

@ -465,7 +465,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
//Redraws top icons (boost/reply)
final float scale = context.getResources().getDisplayMetrics().density;
if( !status.getIn_reply_to_account_id().equals("null") || !status.getIn_reply_to_id().equals("null") ){
if( (status.getIn_reply_to_account_id()!= null && !status.getIn_reply_to_account_id().equals("null")) || (status.getIn_reply_to_id() != null && !status.getIn_reply_to_id().equals("null")) ){
Drawable img = ContextCompat.getDrawable(context, R.drawable.ic_reply);
img.setBounds(0,0,(int) (20 * iconSizePercent/100 * scale + 0.5f),(int) (15 * iconSizePercent/100 * scale + 0.5f));
holder.status_account_displayname.setCompoundDrawables( img, null, null, null);

View File

@ -1665,7 +1665,8 @@ public class Helper {
Gson gson = new Gson();
String json = sharedpreferences.getString(Helper.SET_TEMP_STATUS + userId, null);
Type type = new TypeToken<ArrayList<Status>>() {}.getType();
return gson.fromJson(json, type);
ArrayList<Status> statuses = gson.fromJson(json, type);
return (statuses != null)?statuses:new ArrayList<Status>();
}