Update subdomain.js

matches.length will error out of there are no matches at all and matches is undefined.
This checks if matches exist before calling matches.length.