made collections not crash in gallery view

Viewing a collection in gallery view was crashing. This fixes that.

PSU bug: https://scm.dlt.psu.edu/issues/9486
If someone has a recommendation on how to simplify this before block, I'd love to hear it.