From 74df90da35ed7886c4067fae700c9db1d3b2ef0a Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Sat, 7 Sep 2024 21:02:03 -0400 Subject: Handle no film being loaded --- www/photo.causal.agency/trips.html | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'www/photo.causal.agency') diff --git a/www/photo.causal.agency/trips.html b/www/photo.causal.agency/trips.html index d6c41c3a..6c65b7c0 100644 --- a/www/photo.causal.agency/trips.html +++ b/www/photo.causal.agency/trips.html @@ -219,10 +219,16 @@ function setTripBody() { select.appendChild(option); } let roll = rolls[body.name]; - document.getElementById("trip-film").value = roll.film; - let next = (roll.used > 0 ? roll.used + 1 : roll.used); - document.getElementById("trip-first").value = next; - document.getElementById("trip-last").value = next; + if (roll) { + document.getElementById("trip-film").value = roll.film; + let next = (roll.used > 0 ? roll.used + 1 : roll.used); + document.getElementById("trip-first").value = next; + document.getElementById("trip-last").value = next; + } else { + document.getElementById("trip-film").value = ""; + document.getElementById("trip-first").value = ""; + document.getElementById("trip-last").value = ""; + } } setTripBody(); -- cgit 1.4.1