An approximate Riemann solver for sensitivity equations with discontinuous solutions