Add a 404 check to prevent default loop.

Without this check the default loop might be displayed.
More details here: http://wordpress.stackexchange.com/q/161174/47733