fix(apiv2): don't ISE on invalid entity references

This commit is contained in:
spiral 2021-10-12 08:10:20 -04:00
parent 0aefafb62d
commit 2d72fd6aa1
No known key found for this signature in database
GPG Key ID: A6059F0CA0E1BD31

View File

@ -49,7 +49,7 @@ namespace PluralKit.API
if (_shortIdRegex.IsMatch(systemRef)) if (_shortIdRegex.IsMatch(systemRef))
return _repo.GetSystemByHid(systemRef); return _repo.GetSystemByHid(systemRef);
return null; return Task.FromResult<PKSystem?>(null);
} }
protected Task<PKMember?> ResolveMember(string memberRef) protected Task<PKMember?> ResolveMember(string memberRef)
@ -60,7 +60,7 @@ namespace PluralKit.API
if (_shortIdRegex.IsMatch(memberRef)) if (_shortIdRegex.IsMatch(memberRef))
return _repo.GetMemberByHid(memberRef); return _repo.GetMemberByHid(memberRef);
return null; return Task.FromResult<PKMember?>(null);
} }
protected Task<PKGroup?> ResolveGroup(string groupRef) protected Task<PKGroup?> ResolveGroup(string groupRef)
@ -71,7 +71,7 @@ namespace PluralKit.API
if (_shortIdRegex.IsMatch(groupRef)) if (_shortIdRegex.IsMatch(groupRef))
return _repo.GetGroupByHid(groupRef); return _repo.GetGroupByHid(groupRef);
return null; return Task.FromResult<PKGroup?>(null);
} }
public LookupContext ContextFor(PKSystem system) public LookupContext ContextFor(PKSystem system)