Avoid PHP errors if the RegEx doesn't match anything

Ran into a problem where if I provide an invalid User Agent which doesn't match the RegEx, it throws undefined index 0 errors. So just added a quick check to break out if it didn't match anything.