From a0bdefb71d9609bf0fc93c22079f69a2f84f3b20 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Wed, 12 Jun 2013 13:58:25 -0400 Subject: [PATCH] Fix 'undefined is not an object' traceback with update_active_status. This seems to only happen with Firefox for some reason. We've had similar issues with other ajax endpoints, so this is probably not the long-term solution, but I'd like to get this traceback fixed now. (imported from commit aa552fb56882ae2c73e352c7baf9532a88c5cf0a) --- zephyr/static/js/activity.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zephyr/static/js/activity.js b/zephyr/static/js/activity.js index c2a5fdac1f..b3cb22cbab 100644 --- a/zephyr/static/js/activity.js +++ b/zephyr/static/js/activity.js @@ -96,6 +96,13 @@ function focus_ping() { } $.post('/json/update_active_status', {status: ACTIVE}, function (data) { + if (data === undefined || data.presences === undefined) { + // We sometimes receive no data even on successful + // requests; we should figure out why but this will + // prevent us from throwing errors until then + return; + } + user_info = {}; // Update Zephyr mirror activity warning