summaryrefslogtreecommitdiff
path: root/lib/Travelynx
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-07-14 18:48:46 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2023-07-14 18:48:46 +0200
commitca3cd1580fc9de619abbcfde69a1fd117b2d0533 (patch)
tree482fa08c8a10c88b82edd9f25cc8c24330de02dd /lib/Travelynx
parent882d1fe16f26918c72898908d42ad2c017991a53 (diff)
Journeys->get_latest: Fix uninitialized value warning
Diffstat (limited to 'lib/Travelynx')
-rwxr-xr-xlib/Travelynx/Model/Journeys.pm28
1 files changed, 16 insertions, 12 deletions
diff --git a/lib/Travelynx/Model/Journeys.pm b/lib/Travelynx/Model/Journeys.pm
index a811a7c..a4fe12c 100755
--- a/lib/Travelynx/Model/Journeys.pm
+++ b/lib/Travelynx/Model/Journeys.pm
@@ -709,12 +709,14 @@ sub get_latest {
}
)->expand->hash;
- $latest_successful->{visibility_str}
- = $latest_successful->{visibility}
- ? $visibility_itoa{ $latest_successful->{visibility} }
- : 'default';
- $latest_successful->{effective_visibility_str}
- = $visibility_itoa{ $latest_successful->{effective_visibility} };
+ if ($latest_successful) {
+ $latest_successful->{visibility_str}
+ = $latest_successful->{visibility}
+ ? $visibility_itoa{ $latest_successful->{visibility} }
+ : 'default';
+ $latest_successful->{effective_visibility_str}
+ = $visibility_itoa{ $latest_successful->{effective_visibility} };
+ }
my $latest = $db->select(
'journeys_str',
@@ -728,12 +730,14 @@ sub get_latest {
}
)->expand->hash;
- $latest->{visibility_str}
- = $latest->{visibility}
- ? $visibility_itoa{ $latest->{visibility} }
- : 'default';
- $latest->{effective_visibility_str}
- = $visibility_itoa{ $latest->{effective_visibility} };
+ if ($latest) {
+ $latest->{visibility_str}
+ = $latest->{visibility}
+ ? $visibility_itoa{ $latest->{visibility} }
+ : 'default';
+ $latest->{effective_visibility_str}
+ = $visibility_itoa{ $latest->{effective_visibility} };
+ }
return ( $latest_successful, $latest );
}