According to this post by Johannes Dahlströms, no - you cannot rely on a null value:
Well, yes and no.
The reference returned by UI.getCurrent() is stored in an inheritable
ThreadLocal. When a UI is accessed, either via a client request, or by
the user invoking UI.access(), the UI.getCurrent() value is set to
that UI.
In an arbitrary background thread, outside a UI.access() invocation,
there cannot be a concept of a "current UI". Why, then,
UI.getCurrent() in many cases does return a non-null value even in a
background thread? This is because, as mentioned, the ThreadLocal is
inheritable. That is to say, if a child thread is spawned by a thread
that at that time has UI.getCurrent() set, the value is inherited by
the child thread. This is most likely the effect you're seeing. It
makes some things a bit more convenient, but I'm not actually sure
it's actually a good idea for it to be inheritable - it stretches the
meaning of "current" and may cause the user to forget to do proper
synchronization before accessing the "current" UI.