Fix crash then canvas is too big

Fix crash then canvas is too big