Shopify/browser_sniffer — pull request #1 by dylanahsmith (2013-06-20 12:41:33+00:00)
Title: Handle nil str in REGEX_MAP procs.

@xthexder for review

## Problem

Visitors with certain user agents were causing the following undefined method on nil exceptions:
https://exceptions.shopify.com/apps/94348010af650ed81a58f710f5414b9e/errs/51c229aeb74f334708002c48

## Solution

Those regular expressions were only optionally capturing a string, so changing `str.gsub` to `str && str.gsub` will cause `nil` to be returned for that field instead. For the above mentioned exception, it would just result in the `:os_version` being `nil`.

Added a regression test for that specific browser user-agent.