A Liouville-type theorem for the homogeneous wave equation