Assert on color middleware.

Also reinstate guards against null arg in other middleware, requires
testing.