Fix crash when clicking canvas during document load.