Check for empty string

This commit is contained in:
Abhorrent_Anger 2026-08-16 20:57:37 +03:00
parent e8f2c00170
commit 325d01d014

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name Mann Co. Store Giveaway Autojoiner // @name Mann Co. Store Giveaway Autojoiner
// @namespace http://tampermonkey.net/ // @namespace http://tampermonkey.net/
// @version 2026-08-19 // @version 2026-08-20
// @description Tries to join giveaways on page load // @description Tries to join giveaways on page load
// @author Abhorrent_Anger // @author Abhorrent_Anger
// @include /^https?:\/\/mannco\.store\/giveaways.?$/ // @include /^https?:\/\/mannco\.store\/giveaways.?$/
@ -46,12 +46,12 @@ const getCookieValue = (name) => (
) )
function getTokenFromCookie(tokenName) { function getTokenFromCookie(tokenName) {
let authArray = getCookieValue(tokenName); let tokenArray = getCookieValue(tokenName);
let decodedAuthArray = decodeURIComponent(authArray); let decodedTokenArray = decodeURIComponent(tokenArray);
if (typeof decodedAuthArray !== 'string') { if (typeof decodedTokenArray !== 'string' || !decodedTokenArray) {
return false; return false;
} }
let array = JSON.parse(decodedAuthArray); let array = JSON.parse(decodedTokenArray);
if (Array.isArray(array)) { if (Array.isArray(array)) {
return array['token']; return array['token'];
} }