Add check the command class isn't null

This prevents an NPE during creation of the polling table.