Fix potential out of bounds read.
The check was only done when not memory mapped, so there was a potential out of bounds read. In addition the check only printed an error, and didn't return and went ahead with the erronous read. The 'loc' variable is indirectly read from the file, so in case the history file is corrupted this could potentially lead to a crash. Found by Coverity. REVIEW: 128153