Fixing crash encountered when taking screenshot of non-HTML page.

This intentionally does not throw an error, but fails silently, with
no screenshot being generated. Fixes issue #6576.