Small check to prevent main thread exception.

Fixes an exception on the main thread that causes FD to exit.