From 04d096014e455b97ca3c9a54444af7811d87feae Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 3 Jan 2023 10:12:53 +0100 Subject: Api: Fix 'uninitialized value' warning when no token is set --- lib/Travelynx/Controller/Api.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Travelynx/Controller/Api.pm b/lib/Travelynx/Controller/Api.pm index f686222..8c47e9f 100755 --- a/lib/Travelynx/Controller/Api.pm +++ b/lib/Travelynx/Controller/Api.pm @@ -71,7 +71,10 @@ sub get_v1 { } my $token = $self->get_api_token($uid); - if ( $api_token ne $token->{$api_action} ) { + if ( not $api_token + or not $token->{$api_action} + or $api_token ne $token->{$api_action} ) + { $self->render( json => { error => 'Invalid token', -- cgit v1.2.3