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:
LucasGGamerM
2025-05-08 11:29:07 -03:00
parent 0de346c1bc
commit a8da796956
2 changed files with 6 additions and 1 deletions

View File

@@ -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;

View File

@@ -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;