Skip to content

Commit

Permalink
fix: apparently .get() also throws an exception (#559)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmo314 authored Jul 15, 2022
1 parent c626a99 commit e02605a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/models/adapters/profiles.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ class ProfilesAdapter {
if (!event.exists) {
return null;
}
final data = event.get("twitch");
return data != null
? Channel(provider, data['id'], data['displayName'])
: null;
final data = event.data();
if (data == null || !data.containsKey("twitch")) {
return null;
}
final twitch = data['twitch'];
return Channel(provider, twitch['id'], twitch['displayName']);
});
}

Expand Down

0 comments on commit e02605a

Please sign in to comment.