Do not assert if pattern is empty in query.

Return NULL iterator instead of asserting inside of libpkg.