Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,12 @@ class ViewSpeciesViewModel extends ChangeNotifier {
_speciesSynonyms = details.getOrThrow().speciesSynonymsCompanion;
_log.fine("External species synonyms loaded");

if (details.getOrThrow().speciesCompanion.externalAvatarUrl.present) {
// Drift's `.present` is true for both `Value(something)` and `Value(null)`,
// so we also have to guard against a present-but-null URL. FloraCodex
// can return a species with no `image_url`, which would otherwise crash
// with "null check operator used on a null value" at `.value!` below.
if (details.getOrThrow().speciesCompanion.externalAvatarUrl.present &&
details.getOrThrow().speciesCompanion.externalAvatarUrl.value != null) {
String url =
details.getOrThrow().speciesCompanion.externalAvatarUrl.value!;

Expand Down