From 2e4c5351ac0b94b2e80da9506f93d979fc69dd72 Mon Sep 17 00:00:00 2001
From: Robert Kaiser <kairo@kairo.at>
Date: Sun, 3 Nov 2024 01:06:21 +0100
Subject: [PATCH] make sure we don't get a null uastring

---
 classes/useragent.php-class | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/classes/useragent.php-class b/classes/useragent.php-class
index 190e539..c64117f 100755
--- a/classes/useragent.php-class
+++ b/classes/useragent.php-class
@@ -106,11 +106,12 @@ class userAgent {
     }
     else {
       // read raw UA string
-      $this->uastring = $_SERVER['HTTP_USER_AGENT'];
+      $this->uastring = ($_SERVER['HTTP_USER_AGENT'] ?? '');
     }
 
     // get UA brand and version
-    $this->brand = 'Unknown'; $this->version = null;
+    $this->brand = 'Unknown';
+    $this->version = null;
     // find reasonable defaults
     if (preg_match('|([0-9a-zA-Z\.:()_ -]+)/(\d[0-9a-zA-Z\._+-]*)|', $this->uastring, $regs)) {
       $this->brand = trim($regs[1]);
-- 
2.43.0