Check that selection is not null

thanks coffeescript

@azirbel @Dylnuge