Warily treat an empty or invalid pattern (re #120 and #123)
Merge pull request #127 from scorphus/test-get-for-each-ref

Warily treat empty or invalid pattern (re #120 and #123)
Correctly accept an empty pattern (re #120 and #123)