Fix #9445 (crash during histogram diagram creation)