From c69181048f0f8ae744df4e3ba515d4e7ec23e6a6 Mon Sep 17 00:00:00 2001 From: Jonathan Rosenbaum Date: Mon, 1 Jan 2018 10:45:18 +0000 Subject: [PATCH] Partial fix for #56. --- js/shop.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/shop.js b/js/shop.js index 8591e36..246684a 100644 --- a/js/shop.js +++ b/js/shop.js @@ -143,9 +143,11 @@ $(function(){ var volunteer = "", remaining = 0, vhr = "", max_bikes_earned = 0; if (obj.volunteer) { volunteer = $.parseJSON(obj.volunteer); - remaining = obj.current_year_volunteer_hours - volunteer[year].volunteer_hours_redeemed; - vhr = volunteer[year].volunteer_hours_redeemed; - max_bikes_earned = volunteer[year].max_bike_earned; + if (volunteer.hasOwnProperty(year)) { + remaining = obj.current_year_volunteer_hours - volunteer[year].volunteer_hours_redeemed; + vhr = volunteer[year].volunteer_hours_redeemed; + max_bikes_earned = volunteer[year].max_bike_earned; + } } else { vhr = 0; }