]> source.dussan.org Git - archiva.git/commitdiff
avoid null
authorolivier lamy <olamy@apache.org>
Wed, 10 May 2017 11:35:53 +0000 (21:35 +1000)
committerolivier lamy <olamy@apache.org>
Wed, 10 May 2017 11:35:53 +0000 (21:35 +1000)
Signed-off-by: olivier lamy <olamy@apache.org>
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js

index 4085d4438f58dfa627db30b86a7dd21339171b11..c047c2da87a7ec41a716ddaa9b1b130681bc1fce 100644 (file)
@@ -861,17 +861,19 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
   };
 
   addValidationTokenHeader=function(user) {
-    if (user.validationToken) {
-      $.log("Adding validation token "+user.validationToken);
-      $.ajaxSetup({
-        beforeSend: function (xhr) {
-          xhr.setRequestHeader('X-XSRF-TOKEN', user.validationToken);
-        }
-      });
-    } else {
-      $.log("No validation token in user object "+user.username+", "+user.validationToken);
+    if(user) {
+      if (user.validationToken) {
+        $.log("Adding validation token "+user.validationToken);
+        $.ajaxSetup({
+                      beforeSend: function (xhr) {
+                        xhr.setRequestHeader('X-XSRF-TOKEN', user.validationToken);
+                      }
+                    });
+      } else {
+        $.log("No validation token in user object "+user.username+", "+user.validationToken);
+      }
     }
-  }
+  };
 
   startArchivaApplication=function(){