From 5138f7499c256c6966a2a6d35c029508279b50d0 Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Tue, 1 Aug 2023 15:24:03 -0400 Subject: [PATCH] Fix bots without user agents causing the is mobile stuff to produce errors --- resources/views/templates/base.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/templates/base.blade.php b/resources/views/templates/base.blade.php index d276f2b..9a19f9c 100644 --- a/resources/views/templates/base.blade.php +++ b/resources/views/templates/base.blade.php @@ -2,7 +2,7 @@ @php $page_title = (isset($title) ? $title . ' - ' : '') . env('APP_NAME'); - $device_mobile = preg_match('/Mobi/', Request::header('User-Agent')) || preg_match('/iP(hone|ad|od);/', Request::header('User-Agent')); + $device_mobile = !is_null(Request::header('User-Agent')) && (preg_match('/Mobi/', Request::header('User-Agent')) || preg_match('/iP(hone|ad|od);/', Request::header('User-Agent'))); @endphp