Fix crash when reading from empty history file

Closes #561
Merge pull request #562 from expez/master

Fix crash when reading from empty history file