m_sample was being checked for null after being used, which looks like a null dereference, though actually if m_sample becomes null, the tool will be deactivated anyway. Regardless, this code looks more sensible.