That will limit either input to prevent them from exceeding either supply rail by more than 0.7V.
If you need better than this, you can replace the diodes with zener diodes, and as long as their voltage is significantly greater than 1/2 of your supply voltage (greater then say, 12V in this case), you can limit the excursion to some number of volts away from either supply rail.
Another approach is to place a pair of diodes across the op amps inputs. This will prevent them from differing by more than 0.6V, which is plenty in your application. You still need a way of ensuring that both inputs are not taken further than the supply rails though. You could add these diodes to your existing circuit.
Beware leakage currents through the diodes though. In our case the input resistance should be low enough that this won't have any substantial impact.