guard against bad inputs
Merge pull request #140 from tablexi/84433-bad-search

guard against bad inputs