search: Avoid segfault when given an invalid base

This patch avoids an easily reproduced segmentation violation when
base_path is NULL (as a consequence of being an invalid/non-existent)
path.

Signed-off-by: Anton Lofgren <anton.lofgren@gmail.com>
Merge pull request #360 from catharsis/fix-segfault-on-invalid-basepath

search: Avoid segfault when given an invalid base