The JPEG viewer seems to be really fragile. It crashes if you mix
JPEG files with directories in the same folder; it crashes if you try
to use it twice. Here's a patch which fixes those two bugs. I'll see
if I can add this to the bug tracker.