refactor(status-account-field): make it not a required field, but do throw error if it's null
This is for debugging purposes on newer glitch-soc versions. This should be reverted before a release.
This commit is contained in:
@@ -47,7 +47,7 @@ public class Status extends BaseModel implements DisplayItemsParent, Searchable{
|
||||
public String uri;
|
||||
// @RequiredField // sometimes null on calckey
|
||||
public Instant createdAt;
|
||||
@RequiredField
|
||||
// @RequiredField // sometimes null? Gonna make sure to check everytime. TODO: make account field required again
|
||||
public Account account;
|
||||
// @RequiredField
|
||||
public String content;
|
||||
|
||||
@@ -181,6 +181,11 @@ public abstract class StatusDisplayItem{
|
||||
Bundle args=new Bundle();
|
||||
args.putString("account", accountID);
|
||||
try{
|
||||
// Check if account is null. This should never happen, but it seems to do in latest versions of glitch-soc
|
||||
if (status.account == null || (status.reblog != null && status.reblog.account == null) || (status.quote != null) && status.quote.account == null) {
|
||||
throw new Exception("status " + status.url + " has null account field");
|
||||
}
|
||||
|
||||
ScheduledStatus scheduledStatus=parentObject instanceof ScheduledStatus s ? s : null;
|
||||
|
||||
HeaderStatusDisplayItem header=null;
|
||||
|
||||
Reference in New Issue
Block a user