{% if your_variable is null or your_variable is empty %}
should check whether the variable is null or empty.
If you want to see if it’s not null or empty just use the not
operator.
{% if foo is not null and foo is not empty %}
See the docs:
- empty
- null
- “is” operator
- logical operators like “not”
Perhaps you might be interested in tests in twig generally.