Fix a crash in debug mode with no threads.