Twig Error Runtime When Using Conditionals
Craft doesn't redirect to 404 if a page isn't found, it just loads the 404 template and keeps the invalid uri.

What currently happens:


example.com/invalid_uri
Craft doesn't find it and shows the 404 template
Your conditional checks if 404 is in the uri, but it isn't.
Your code now tries to access the entry variable which isn't defined.
This results in a Twig error.


.

Solution:

Add an entry is defined to your conditional:

{% if craft.request.getSegment(1) != "404" and craft.request.getSegment(1) != "databytes" and entry is defined %}
....
{% endif %}