Fixing a possible exception in the time range painter.