avoid creating a histogram without range (fixes #10832)