Skip to content

Commit

Permalink
fix: handle invalid json response
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmo314 authored Dec 18, 2021
1 parent a4143cc commit e57638e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion functions/src/twitch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function getTwitchLogin(uid: string, id: string) {

const json = await response.json();

if (json["data"].length == 0) {
if (!json || !json["data"] || json["data"].length == 0) {
return null;
}
return json["data"][0]["login"] as string;
Expand Down

0 comments on commit e57638e

Please sign in to comment.