Fix a crash when opening very long URL with "Keep history of recently opened file" enabled.

This commit fixes #3564.