diff --git a/lib/classes/auth_plugins/StudipAuthShib.php b/lib/classes/auth_plugins/StudipAuthShib.php
index 5548e92c14debed7f9c22c29fedf5d8aa1b2a61c..f18f0c1e5e8fa0541f808877f8d15ebb02d07f48 100644
--- a/lib/classes/auth_plugins/StudipAuthShib.php
+++ b/lib/classes/auth_plugins/StudipAuthShib.php
@@ -42,12 +42,14 @@ class StudipAuthShib extends StudipAuthSSO
 
             $this->userdata = json_decode($auth, true);
 
-            if ($this->username_attribute !== 'username') {
-                $this->userdata['username'] = $this->userdata[$this->username_attribute];
-            }
-            if (isset($this->local_domain)) {
-                $this->userdata['username'] =
-                    str_replace('@' . $this->local_domain, '', $this->userdata['username']);
+            if ($this->userdata) {
+                if ($this->username_attribute !== 'username') {
+                    $this->userdata['username'] = $this->userdata[$this->username_attribute];
+                }
+                if (isset($this->local_domain)) {
+                    $this->userdata['username'] =
+                        str_replace('@' . $this->local_domain, '', $this->userdata['username']);
+                }
             }
         }
     }