magit-save-buffers-predicate-tree-only: bugfix

This function might end up being called outside a repository (because it
is used carelessly, see next branch for a better approach) so we have to
make sure it does not try anything stupid in that case.  Fixes #1499.