Add check for empty document.

When accessing an empty page, it shows an error.

This will respond 404 to the request.