Skip to content

Commit

Permalink
Merge pull request #170 from emrysal/bugfix/crash-when-username-does-…
Browse files Browse the repository at this point in the history
…not-exist-#144

Check if user exists or return a 404 before proceeding
  • Loading branch information
baileypumfleet committed May 7, 2021
2 parents 7cf0504 + 5615db5 commit 99ddb8a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pages/[user]/[type].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,12 @@ export async function getServerSideProps(context) {
}
});

if (!user) {
return {
notFound: true,
}
}

const eventType = await prisma.eventType.findFirst({
where: {
userId: user.id,
Expand Down

1 comment on commit 99ddb8a

@vercel
Copy link

@vercel vercel bot commented on 99ddb8a May 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.