Handle bugs in neopets username data

Huh, looks like it's possible for a user's NeopetsConnection record to be missing, despite having the ID on their User record!

Here, we handle that case.
This commit is contained in:
Emi Matchu 2021-01-19 13:55:25 -08:00
parent 8aa644a031
commit 94efb80e65

View file

@ -53,6 +53,10 @@ const resolvers = {
const neopetsConnection = await neopetsConnectionLoader.load( const neopetsConnection = await neopetsConnectionLoader.load(
user.contactNeopetsConnectionId user.contactNeopetsConnectionId
); );
if (!neopetsConnection) {
return null;
}
return neopetsConnection.neopetsUsername; return neopetsConnection.neopetsUsername;
}, },