Yes but you should reverse the D1 diode, the point is that when the input voltage is more positive than the 5v (5+ diode forward voltage) then diode 1 will conduct,
diode 2 will work the same way if the input becomes lower than the gnd-Vf.
This is why it is also important to use diodes with low forward voltage , 1n4148 has about 0.7v so 5+0.7=5.7v, it is too much or you should connect it to a lower voltage,
on the other hand BAT85 has 0.2v so it will be 5+0.2v=5.2v
Alex