summary refs log tree commit diff
path: root/www/photo.causal.agency/trips.html
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2024-09-07 21:02:03 -0400
committerJune McEnroe <june@causal.agency>2024-09-07 21:02:03 -0400
commit74df90da35ed7886c4067fae700c9db1d3b2ef0a (patch)
treeac1e043c037dfde6d63b46a9f094151921f6725a /www/photo.causal.agency/trips.html
parentFancy up the text a little (diff)
downloadsrc-74df90da35ed7886c4067fae700c9db1d3b2ef0a.tar.gz
src-74df90da35ed7886c4067fae700c9db1d3b2ef0a.zip
Handle no film being loaded
Diffstat (limited to 'www/photo.causal.agency/trips.html')
-rw-r--r--www/photo.causal.agency/trips.html14
1 files changed, 10 insertions, 4 deletions
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();