Wrong
{% if var is not null and var is defined %}
This does not work because a variable which is null in twig is defnied, but if you check for null first and it is not defined it will throw an error.
Correct
{% if var is defined and var is not null %}
This will work because we check if it is defined first and will abord when not. Only if the variable is defined we check if it is null.