Fixed chrash when selecting empty layer