From fa879128e7569d5d8a0b41e6d1a8bd792bd6047e Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sat, 14 Apr 2018 13:07:28 +0200 Subject: [PATCH] Fix: Not all upgrades do have onclick handler Signed-off-by: Knut Ahlers --- autocookieclicker.user.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/autocookieclicker.user.js b/autocookieclicker.user.js index 7b4346d..6fcccdd 100644 --- a/autocookieclicker.user.js +++ b/autocookieclicker.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Automate CookieClicker // @namespace https://luzifer.io/ -// @version 0.7.1 +// @version 0.7.2 // @description Automate everything! // @author Knut Ahlers // @source https://github.com/Luzifer/automate-cookie-clicker @@ -109,6 +109,10 @@ function getMaxBuy() { })(); function upgradeFilter(idx) { - var upgradeID = parseInt($(this).attr('onclick').replace(/^.*\[([0-9]+)\].*$/, "$1")) + var onClickHandler = $(this).attr('onclick'); + if onClickHandler == null { + return false; + } + var upgradeID = parseInt(onClickHandler.replace(/^.*\[([0-9]+)\].*$/, "$1")) return !blockingUpgrades.includes(upgradeID); }