From 94efb80e6573dd355c25af6ff1927ca47ba84cd7 Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 19 Jan 2021 13:55:25 -0800 Subject: [PATCH] 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. --- src/server/types/User.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/server/types/User.js b/src/server/types/User.js index 07d6cd1..88190fb 100644 --- a/src/server/types/User.js +++ b/src/server/types/User.js @@ -53,6 +53,10 @@ const resolvers = { const neopetsConnection = await neopetsConnectionLoader.load( user.contactNeopetsConnectionId ); + if (!neopetsConnection) { + return null; + } + return neopetsConnection.neopetsUsername; },