Don't crash on images in subpages, or images with invalid titles.

Change-Id: I78fdecc7b5529fe22943809c72b57dae55faab0c