Say what you want about Dwight, but he was ready to defend the office at a moment's notice.

One minute he is working at his desk. Then, IMMEDIATELY he is able to analyze the situation, grab the pepper spray, and subdue Roy before Jim is attacked.