From d2671d0fa67139ef8022c34dce4eab4eed03bd61 Mon Sep 17 00:00:00 2001 From: Matchu Date: Thu, 22 Oct 2020 20:53:21 -0700 Subject: [PATCH] fix ItemPage safeImageUrl loading bug When you navigated directly to ItemPage, the new `safeImageUrl` function would crash during the loading state, because it was trying to safe-ify `undefined`. Now, I've just made `safeImageUrl` more resilient to that particular kind of unexpected input, by passing through null-y values without change. --- src/app/util.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/util.js b/src/app/util.js index 136ed09..8bd4122 100644 --- a/src/app/util.js +++ b/src/app/util.js @@ -65,6 +65,10 @@ export function Heading2({ children, ...props }) { * safeImageUrl returns an HTTPS-safe image URL for Neopets assets! */ export function safeImageUrl(urlString) { + if (urlString == null) { + return urlString; + } + const url = new URL(urlString); if (url.origin === "http://images.neopets.com") {