From cdbfc3c3db3e5aef842dd181832000cef542ba92 Mon Sep 17 00:00:00 2001 From: kriddles <54413450+kriddles@users.noreply.github.com> Date: Fri, 17 Jan 2020 11:06:33 -0600 Subject: [PATCH] productcard.js check null location (#494) --- public/viewjs/components/productcard.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/viewjs/components/productcard.js b/public/viewjs/components/productcard.js index f181127f..defd3a80 100644 --- a/public/viewjs/components/productcard.js +++ b/public/viewjs/components/productcard.js @@ -15,7 +15,10 @@ Grocy.Components.ProductCard.Refresh = function(productId) $('#productcard-product-last-purchased-timeago').attr("datetime", productDetails.last_purchased || '2999-12-31'); $('#productcard-product-last-used').text((productDetails.last_used || '2999-12-31').substring(0, 10)); $('#productcard-product-last-used-timeago').attr("datetime", productDetails.last_used || '2999-12-31'); - $('#productcard-product-location').text(productDetails.location.name); + if (productDetails.location != null) + { + $('#productcard-product-location').text(productDetails.location.name); + } $('#productcard-product-spoil-rate').text((parseFloat(productDetails.spoil_rate_percent) / 100).toLocaleString(undefined, { style: "percent" })); if (productDetails.is_aggregated_amount == 1)