From 401acb366543d01f4c36690221d97bc26e08b207 Mon Sep 17 00:00:00 2001 From: Justin Coyne Date: Wed, 17 Jan 2024 16:05:23 -0600 Subject: [PATCH] Correctly check for NaN case --- app/assets/javascripts/jquery.preview-gallery.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/jquery.preview-gallery.js b/app/assets/javascripts/jquery.preview-gallery.js index c5cf0b36c..79796d0d9 100644 --- a/app/assets/javascripts/jquery.preview-gallery.js +++ b/app/assets/javascripts/jquery.preview-gallery.js @@ -125,8 +125,14 @@ / to have a bad time with an infinite while loop. This only manifests / on the show page when using the "back" button to get back to a show / page using the browse nearby feature. + / + / Reproduction steps for NaN: + / 1. visit https://searchworks.stanford.edu/view/2279186 + / 2. click on the bound-with link "Copy 1 bound with v. 5, no. 1. 36105026515499 (item id)" + / 3. click the back button + / */ - if ($itemsPerRow === NaN || $itemsPerRow === 0) { + if (Number.isNaN($itemsPerRow) || $itemsPerRow === 0) { return; }