tools: check we have a view before trying to use it

This may happen when there are no tabs and using an always
available tool.