A uniqueness criterion for the Riemann problem