Allow calling switchTool while no canvas is visible
This fixes a regression from commit 6715c0e5 that causes an assertion when switching tools using a keyboard shortcut with no document open, reported in !764 (comment 209567).
Edited by Paolo Amadini