avoid creating a histogram without range (fixes #11217)