From d99a2fd948c1af10c7b0704200e88e56c0ee45e0 Mon Sep 17 00:00:00 2001 From: Dakota Schneider Date: Thu, 23 Jul 2015 16:14:16 -0700 Subject: [PATCH] check getRatelimit callback before calling it --- tbutils.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tbutils.js b/tbutils.js index 773139c..0050d5c 100644 --- a/tbutils.js +++ b/tbutils.js @@ -1139,10 +1139,12 @@ function initwrapper() { ratelimitReset = jqxhr.getResponseHeader('x-ratelimit-reset'); $.log('ratelimitRemaining: ' + ratelimitRemaining + ' ratelimitReset: ' + (ratelimitReset / 60), false, SHORTNAME); - callback({ - 'ratelimitRemaining': ratelimitRemaining, - 'ratelimitReset': ratelimitReset - }) + if (typeof callback !== "undefined") { + callback({ + 'ratelimitRemaining': ratelimitRemaining, + 'ratelimitReset': ratelimitReset + }); + } }); };