Check if lastShownCanvas exists before using it